From: Jos Wang <joswang(a)lenovo.com>
This is a workaround for STAR 4846132, which only affects
DWC_usb31 version2.00a operating in host mode.
There is a problem in DWC_usb31 version 2.00a operating
in host mode that would cause a CSR read timeout When CSR
read coincides with RAM Clock Gating Entry. By disable
Clock Gating, sacrificing power consumption for normal
operation.
Cc: stable(a)vger.kernel.org
Signed-off-by: Jos Wang <joswang(a)lenovo.com>
---
v5 -> v6: no change
v4 -> v5: no change
v3 -> v4: modify commit message, add Cc: stable(a)vger.kernel.org
v2 -> v3:
- code refactor
- modify comment, add STAR number, workaround applied in host mode
- modify commit message, add STAR number, workaround applied in host mode
- modify Author Jos Wang
v1 -> v2: no change
drivers/usb/dwc3/core.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 7ee61a89520b..2a3adc80fe0f 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -957,12 +957,16 @@ static bool dwc3_core_is_valid(struct dwc3 *dwc)
static void dwc3_core_setup_global_control(struct dwc3 *dwc)
{
+ unsigned int power_opt;
+ unsigned int hw_mode;
u32 reg;
reg = dwc3_readl(dwc->regs, DWC3_GCTL);
reg &= ~DWC3_GCTL_SCALEDOWN_MASK;
+ hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0);
+ power_opt = DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1);
- switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1)) {
+ switch (power_opt) {
case DWC3_GHWPARAMS1_EN_PWROPT_CLK:
/**
* WORKAROUND: DWC3 revisions between 2.10a and 2.50a have an
@@ -995,6 +999,20 @@ static void dwc3_core_setup_global_control(struct dwc3 *dwc)
break;
}
+ /*
+ * This is a workaround for STAR#4846132, which only affects
+ * DWC_usb31 version2.00a operating in host mode.
+ *
+ * There is a problem in DWC_usb31 version 2.00a operating
+ * in host mode that would cause a CSR read timeout When CSR
+ * read coincides with RAM Clock Gating Entry. By disable
+ * Clock Gating, sacrificing power consumption for normal
+ * operation.
+ */
+ if (power_opt != DWC3_GHWPARAMS1_EN_PWROPT_NO &&
+ hw_mode != DWC3_GHWPARAMS0_MODE_GADGET && DWC3_VER_IS(DWC31, 200A))
+ reg |= DWC3_GCTL_DSBLCLKGTNG;
+
/* check if current dwc3 is on simulation board */
if (dwc->hwparams.hwparams6 & DWC3_GHWPARAMS6_EN_FPGA) {
dev_info(dwc->dev, "Running with FPGA optimizations\n");
--
2.17.1
Hi Sasha,
Thanks for adapting this patch to the stable branch. Just one nit.
On 2024/6/16 10:05, Sasha Levin wrote:
> This is a note to let you know that I've just added the patch titled
>
> ext4: fix slab-out-of-bounds in ext4_mb_find_good_group_avg_frag_lists()
>
> to the 6.9-stable tree which can be found at:
> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
>
> The filename of the patch is:
> ext4-fix-slab-out-of-bounds-in-ext4_mb_find_good_gro.patch
> and it can be found in the queue-6.9 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable(a)vger.kernel.org> know about it.
>
>
>
> commit 84cee2d2394a43766dd2990edac8a4a05817ef7b
> Author: Baokun Li <libaokun1(a)huawei.com>
> Date: Tue Mar 19 19:33:20 2024 +0800
>
> ext4: fix slab-out-of-bounds in ext4_mb_find_good_group_avg_frag_lists()
>
> [ Upstream commit 13df4d44a3aaabe61cd01d277b6ee23ead2a5206 ]
>
> We can trigger a slab-out-of-bounds with the following commands:
>
> mkfs.ext4 -F /dev/$disk 10G
> mount /dev/$disk /tmp/test
> echo 2147483647 > /sys/fs/ext4/$disk/mb_group_prealloc
> echo test > /tmp/test/file && sync
>
> ==================================================================
> BUG: KASAN: slab-out-of-bounds in ext4_mb_find_good_group_avg_frag_lists+0x8a/0x200 [ext4]
> Read of size 8 at addr ffff888121b9d0f0 by task kworker/u2:0/11
> CPU: 0 PID: 11 Comm: kworker/u2:0 Tainted: GL 6.7.0-next-20240118 #521
> Call Trace:
> dump_stack_lvl+0x2c/0x50
> kasan_report+0xb6/0xf0
> ext4_mb_find_good_group_avg_frag_lists+0x8a/0x200 [ext4]
> ext4_mb_regular_allocator+0x19e9/0x2370 [ext4]
> ext4_mb_new_blocks+0x88a/0x1370 [ext4]
> ext4_ext_map_blocks+0x14f7/0x2390 [ext4]
> ext4_map_blocks+0x569/0xea0 [ext4]
> ext4_do_writepages+0x10f6/0x1bc0 [ext4]
> [...]
> ==================================================================
>
> The flow of issue triggering is as follows:
>
> // Set s_mb_group_prealloc to 2147483647 via sysfs
> ext4_mb_new_blocks
> ext4_mb_normalize_request
> ext4_mb_normalize_group_request
> ac->ac_g_ex.fe_len = EXT4_SB(sb)->s_mb_group_prealloc
> ext4_mb_regular_allocator
> ext4_mb_choose_next_group
> ext4_mb_choose_next_group_best_avail
> mb_avg_fragment_size_order
> order = fls(len) - 2 = 29
> ext4_mb_find_good_group_avg_frag_lists
> frag_list = &sbi->s_mb_avg_fragment_size[order]
> if (list_empty(frag_list)) // Trigger SOOB!
>
> At 4k block size, the length of the s_mb_avg_fragment_size list is 14,
> but an oversized s_mb_group_prealloc is set, causing slab-out-of-bounds
> to be triggered by an attempt to access an element at index 29.
>
> Add a new attr_id attr_clusters_in_group with values in the range
> [0, sbi->s_clusters_per_group] and declare mb_group_prealloc as
> that type to fix the issue. In addition avoid returning an order
> from mb_avg_fragment_size_order() greater than MB_NUM_ORDERS(sb)
> and reduce some useless loops.
>
> Fixes: 7e170922f06b ("ext4: Add allocation criteria 1.5 (CR1_5)")
> CC: stable(a)vger.kernel.org
> Signed-off-by: Baokun Li <libaokun1(a)huawei.com>
> Reviewed-by: Jan Kara <jack(a)suse.cz>
> Reviewed-by: Ojaswin Mujoo <ojaswin(a)linux.ibm.com>
> Link: https://lore.kernel.org/r/20240319113325.3110393-5-libaokun1@huawei.com
> Signed-off-by: Theodore Ts'o <tytso(a)mit.edu>
> Signed-off-by: Sasha Levin <sashal(a)kernel.org>
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 714f83632e3f9..66b5a68b0254e 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -831,6 +831,8 @@ static int mb_avg_fragment_size_order(struct super_block *sb, ext4_grpblk_t len)
> return 0;
> if (order == MB_NUM_ORDERS(sb))
> order--;
> + if (WARN_ON_ONCE(order > MB_NUM_ORDERS(sb)))
> + order = MB_NUM_ORDERS(sb) - 1;
> return order;
> }
>
> @@ -1008,6 +1010,8 @@ static void ext4_mb_choose_next_group_best_avail(struct ext4_allocation_context
> * goal length.
> */
> order = fls(ac->ac_g_ex.fe_len) - 1;
> + if (WARN_ON_ONCE(order - 1 > MB_NUM_ORDERS(ac->ac_sb)))
> + order = MB_NUM_ORDERS(ac->ac_sb);
> min_order = order - sbi->s_mb_best_avail_max_trim_order;
> if (min_order < 0)
> min_order = 0;
> diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
> index 295ea9a32de91..ca66e33f61815 100644
> --- a/fs/ext4/sysfs.c
> +++ b/fs/ext4/sysfs.c
> @@ -29,6 +29,7 @@ typedef enum {
> attr_trigger_test_error,
> attr_first_error_time,
> attr_last_error_time,
> + attr_clusters_in_group,
> attr_feature,
> attr_pointer_ui,
> attr_pointer_ul,
> @@ -207,13 +208,14 @@ EXT4_ATTR_FUNC(sra_exceeded_retry_limit, 0444);
>
> EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, inode_readahead,
> ext4_sb_info, s_inode_readahead_blks);
> +EXT4_ATTR_OFFSET(mb_group_prealloc, 0644, clusters_in_group,
> + ext4_sb_info, s_mb_group_prealloc);
> EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal);
> EXT4_RW_ATTR_SBI_UI(mb_stats, s_mb_stats);
> EXT4_RW_ATTR_SBI_UI(mb_max_to_scan, s_mb_max_to_scan);
> EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
> EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs);
> EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request);
> -EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc);
> EXT4_RW_ATTR_SBI_UI(mb_max_linear_groups, s_mb_max_linear_groups);
> EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb);
> EXT4_ATTR(trigger_fs_error, 0200, trigger_test_error);
> @@ -376,6 +378,7 @@ static ssize_t ext4_generic_attr_show(struct ext4_attr *a,
>
> switch (a->attr_id) {
> case attr_inode_readahead:
> + case attr_clusters_in_group:
> case attr_pointer_ui:
> if (a->attr_ptr == ptr_ext4_super_block_offset)
> return sysfs_emit(buf, "%u\n", le32_to_cpup(ptr));
> @@ -459,6 +462,14 @@ static ssize_t ext4_attr_store(struct kobject *kobj,
> else
> *((unsigned int *) ptr) = t;
> return len;
> + case attr_clusters_in_group:
Since commit f536808adcc3 "ext4: refactor out ext4_generic_attr_store()"
is not backported to stable, the following judgement needs to be added
here:
if (!ptr)
return 0;
The patch for the 6.6-stable tree has the same problem.
Regards,
Baokun
> + ret = kstrtouint(skip_spaces(buf), 0, &t);
> + if (ret)
> + return ret;
> + if (t > sbi->s_clusters_per_group)
> + return -EINVAL;
> + *((unsigned int *) ptr) = t;
> + return len;
> case attr_pointer_ul:
> if (!ptr)
> return 0;
TGL systems have the same issue as ADL, where a large boot firmware
delay is seen if USB ports are left in U3 at shutdown. So apply the
XHCI_RESET_TO_DEFAULT quirk to TGL as well.
The issue it fixes is a ~20s boot time delay when booting from S5. It
affects TGL devices, and TGL support was added starting from v5.3.
Cc: stable(a)vger.kernel.org
Signed-off-by: Reka Norman <rekanorman(a)chromium.org>
---
Changes in v2:
- Add cc stable
drivers/usb/host/xhci-pci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index c040d816e626..137bd3da1128 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -49,6 +49,7 @@
#define PCI_DEVICE_ID_INTEL_DENVERTON_XHCI 0x19d0
#define PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI 0x8a13
#define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI 0x9a13
+#define PCI_DEVICE_ID_INTEL_TIGER_LAKE_PCH_XHCI 0xa0ed
#define PCI_DEVICE_ID_INTEL_COMET_LAKE_XHCI 0xa3af
#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed
#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_PCH_XHCI 0x54ed
@@ -372,7 +373,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
xhci->quirks |= XHCI_MISSING_CAS;
if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
- (pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI ||
+ (pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_PCH_XHCI ||
+ pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI ||
pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_PCH_XHCI))
xhci->quirks |= XHCI_RESET_TO_DEFAULT;
--
2.45.2.627.g7a2c4fd464-goog
On Sun, Jun 16, 2024 at 4:11 AM Sasha Levin <sashal(a)kernel.org> wrote:
>
> Cc: stable(a)vger.kernel.org # v6.6+
This cannot be backported to 6.1 unless we upgrade the compiler, since
the feature is not available in old versions.
For future reference, this patch got picked for 6.1 a couple more times:
https://lore.kernel.org/stable/CANiq72=V1=D-X5ncqN1pyfE4L1bz5zFRdBot6HpkCYi…https://lore.kernel.org/stable/CANiq72ndLzts-KzUv_22vHF0tYkPvROv=oG+KP2KhbC…
If I had known it would cause your scripts to pick it up repeatedly,
then I would have probably avoided `Fixes`/`Cc` -- it is a very minor
issue.
Cheers,
Miguel
Since upstream commit:
* 0f4765d0 "selftests/net: convert unicast_extensions.sh to run it in
unique namespace"
* 378f082e "selftests/net: convert pmtu.sh to run it in unique namespace"
The lib.sh from commit 25ae948b "selftests/net: add lib.sh" will be needed.
Otherwise these test will complain about missing files and fail:
$ sudo ./unicast_extensions.sh
./unicast_extensions.sh: line 31: lib.sh: No such file or directory
...
$ sudo ./pmtu.sh
./pmtu.sh: line 201: lib.sh: No such file or directory
./pmtu.sh: line 941: cleanup_all_ns: command not found
...
Another commit b6925b4e "selftests/net: add variable NS_LIST for lib.sh" is
needed to add support for the cleanup_all_ns above.
And 2114e833 "selftests: forwarding: Avoid failures to source net/lib.sh" is
a follow-up fix for tests inside the net/forwarding directory.
V2: Add 2114e833 "selftests: forwarding: Avoid failures to source net/lib.sh"
as suggested by Hangbin Liu.
V3: Adjust commit 25ae948b to add lib.sh directly to TEST_FILES in Makefile,
as we already have upstream commit 06efafd8 that would make this change
landed in 6.6.y.
Benjamin Poirier (1):
selftests: forwarding: Avoid failures to source net/lib.sh
Hangbin Liu (2):
selftests/net: add lib.sh
selftests/net: add variable NS_LIST for lib.sh
tools/testing/selftests/net/Makefile | 2 +-
tools/testing/selftests/net/forwarding/lib.sh | 52 +++++++--------
tools/testing/selftests/net/lib.sh | 93 +++++++++++++++++++++++++++
3 files changed, 120 insertions(+), 27 deletions(-)
create mode 100644 tools/testing/selftests/net/lib.sh
--
2.7.4
Greetings fellas,
I have encountered a critical bug in the Linux vanilla kernel that
leads to a kernel panic during the shutdown or reboot process. The
issue arises after all services, including `journald`, have been
stopped. As a result, the machine fails to complete the shutdown or
reboot procedure, effectively causing the system to hang and not shut
down or reboot.
Here are the details of the issue:
- Affected Versions: Before kernel version 6.8.10, the bug caused a
quick display of a kernel trace dump before the shutdown/reboot
completed. Starting from version 6.8.10 and continuing into version
6.9.0 and 6.9.1, this issue has escalated to a kernel panic,
preventing the shutdown or reboot from completing and leaving the
machine stuck.
- Symptoms:
- In normal shutdown/reboot scenarios, the kernel trace dump briefly
appears as the last message on the screen.
- In rescue mode, the kernel panic message is displayed. Normally it
is not shown.
Since `journald` is stopped before this issue occurs, no textual logs
are available. However, I have captured two pictures illustrating
these related issues, which I am attaching to this email for your
reference. Also added my custom kernel config.
Thank you for your attention to this matter. Please let me know if any
additional information is required to assist in diagnosing and
resolving this bug.
Best regards,
Ilkka Naulapää
The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 8031b58c3a9b1db3ef68b3bd749fbee2e1e1aaa3
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable(a)vger.kernel.org>' --in-reply-to '2024061719-prewashed-wimp-a695@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..
Possible dependencies:
8031b58c3a9b ("mptcp: ensure snd_una is properly initialized on connect")
fb7a0d334894 ("mptcp: ensure snd_nxt is properly initialized on connect")
54f1944ed6d2 ("mptcp: factor out mptcp_connect()")
a42cf9d18278 ("mptcp: poll allow write call before actual connect")
d98a82a6afc7 ("mptcp: handle defer connect in mptcp_sendmsg")
3e5014909b56 ("mptcp: cleanup MPJ subflow list handling")
3d1d6d66e156 ("mptcp: implement support for user-space disconnect")
b29fcfb54cd7 ("mptcp: full disconnect implementation")
3ce0852c86b9 ("mptcp: enforce HoL-blocking estimation")
7cd2802d7496 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 8031b58c3a9b1db3ef68b3bd749fbee2e1e1aaa3 Mon Sep 17 00:00:00 2001
From: Paolo Abeni <pabeni(a)redhat.com>
Date: Fri, 7 Jun 2024 17:01:48 +0200
Subject: [PATCH] mptcp: ensure snd_una is properly initialized on connect
This is strictly related to commit fb7a0d334894 ("mptcp: ensure snd_nxt
is properly initialized on connect"). It turns out that syzkaller can
trigger the retransmit after fallback and before processing any other
incoming packet - so that snd_una is still left uninitialized.
Address the issue explicitly initializing snd_una together with snd_nxt
and write_seq.
Suggested-by: Mat Martineau <martineau(a)kernel.org>
Fixes: 8fd738049ac3 ("mptcp: fallback in case of simultaneous connect")
Cc: stable(a)vger.kernel.org
Reported-by: Christoph Paasch <cpaasch(a)apple.com>
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/485
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
Reviewed-by: Mat Martineau <martineau(a)kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe(a)kernel.org>
Link: https://lore.kernel.org/r/20240607-upstream-net-20240607-misc-fixes-v1-1-1a…
Signed-off-by: Jakub Kicinski <kuba(a)kernel.org>
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 96b113854bd3..bb7dca8aa2d9 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3740,6 +3740,7 @@ static int mptcp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
WRITE_ONCE(msk->write_seq, subflow->idsn);
WRITE_ONCE(msk->snd_nxt, subflow->idsn);
+ WRITE_ONCE(msk->snd_una, subflow->idsn);
if (likely(!__mptcp_check_fallback(msk)))
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVE);