7.0.7-rc1 review
Greg Kroah-Hartman
maintainerPATCH 306/307 rust: pin-init: fix incorrect accessor reference lifetime
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gary Guo <[email protected]>
commit 68bf102226cf2199dc609b67c1e847cad4de4b57 upstream
When a field has been initialized, init!/pin_init! create a reference or pinned reference to the field so it can be accessed later during the initialization of other fields. However, the reference it created is incorrectly &'static rather than just the scope of the initializer.
This means that you can do
init!(Foo {
a: 1,
_: {
let b: &'static u32 = a;
}
})which is unsound.
This is caused by &mut (*#slot).#ident, which actually allows arbitrary lifetime, so this is effectively 'static. Somewhat ironically, the safety justification of creating the accessor is.. "SAFETY: TODO".
Fix it by adding let_binding method on DropGuard to shorten lifetime. This results exactly what we want for these accessors. The safety and invariant comments of DropGuard have been reworked; instead of reasoning about what caller can do with the guard, express it in a way that the ownership is transferred to the guard and forget takes it back, so the unsafe operations within the DropGuard can be more easily justified.
--- rust/pin-init/internal/src/init.rs | 106 ++++++++++++++++--------------------- rust/pin-init/src/__internal.rs | 28 ++++++--- 2 files changed, 66 insertions(+), 68 deletions(-)
rust/pin-init/internal/src/init.rs +47 -59
@@ -243,18 +243,6 @@ fn init_fields( });// Again span for better diagnostics let write =quote_spanned! (ident.span ()=> ::core::ptr::write); -let accessor =if pinned { -let project_ident =format_ident! ("__project_{ident}" ); -quote! { -// SAFETY: TODO -unsafe { #data.#project_ident (&mut (*#slot).#ident) } - } - }else { -quote! { -// SAFETY: TODO -unsafe { &mut (*#slot).#ident } - } - };quote! { #(#attrs)* {
@@ -262,51 +250,31 @@ fn init_fields(// SAFETY: TODO unsafe { #write(::core::ptr::addr_of_mut!((*#slot).#ident), #value_ident) }; } - #(#cfgs)* -#[allow(unused_variables)] - let #ident = #accessor; } } InitializerKind::Init { ident, value, .. } => { // Again span for better diagnostics let init = format_ident!("init", span = value.span()); - // NOTE: the field accessor ensures that the initialized field is properly aligned. - // Unaligned fields will cause the compiler to emit E0793. We do not support - // unaligned fields since `Init::__init` requires an aligned pointer; the call to - // `ptr::write` below has the same requirement. - let (value_init, accessor) = if pinned { - let project_ident = format_ident!("__project_{ident}"); - ( - quote! { - // SAFETY: - // - `slot` is valid, because we are inside of an initializer closure, we - // return when an error/panic occurs. - // - We also use `#data` to require the correct trait (`Init` or `PinInit`) - // for `#ident`. - unsafe { #data.#ident(::core::ptr::addr_of_mut!((*#slot).#ident), #init)? }; - }, - quote! { - // SAFETY: TODO - unsafe { #data.#project_ident(&mut (*#slot).#ident) } - }, - ) + let value_init = if pinned { + quote! { + // SAFETY: + // - `slot` is valid, because we are inside of an initializer closure, we + // return when an error/panic occurs. + // - We also use `#data` to require the correct trait (`Init` or `PinInit`) + // for `#ident`. + unsafe { #data.#ident(::core::ptr::addr_of_mut!((*#slot).#ident), #init)? }; + } } else { - ( - quote! { - // SAFETY: `slot` is valid, because we are inside of an initializer - // closure, we return when an error/panic occurs. - unsafe { - ::pin_init::Init::__init( - #init, - ::core::ptr::addr_of_mut!((*#slot).#ident), - )? - }; - }, - quote! { - // SAFETY: TODO - unsafe { &mut (*#slot).#ident } - }, - ) + quote! { + // SAFETY: `slot` is valid, because we are inside of an initializer + // closure, we return when an error/panic occurs. + unsafe { + ::pin_init::Init::__init( + #init, + ::core::ptr::addr_of_mut!((*#slot).#ident), + )? + }; + } }; quote! { #(#attrs)*
@@ -314,9 +282,6 @@ fn init_fields( let #init = #value; #value_init } - #(#cfgs)* -#[allow(unused_variables)] - let #ident = #accessor; } } InitializerKind::Code { block: value, .. } => quote! {
@@ -329,18 +294,41 @@ fn init_fields(if let Some (ident) = kind.ident () {// `mixed_site` ensures that the guard is not accessible to the user-controlled code. let guard =format_ident! ("__{ident}_guard" , span =Span ::mixed_site ()); + +// NOTE: The reference is derived from the guard so that it only lives as long as the +// guard does and cannot escape the scope. If it's created via `&mut (*#slot).#ident` +// like the unaligned field guard, it will become effectively `'static`. +let accessor =if pinned { +let project_ident =format_ident! ("__project_{ident}" ); +quote! { +// SAFETY: the initialization is pinned. +unsafe { #data.#project_ident (#guard.let_binding ()) } + } + }else { +quote! { + #guard.let_binding () + } + }; + res.extend (quote! { #(#cfgs)* -// Create the drop guard: +// Create the drop guard. // -// We rely on macro hygiene to make it impossible for users to access this local -// variable. -// SAFETY: We forget the guard later when initialization has succeeded. -let #guard =unsafe { +// SAFETY: +// - `&raw mut (*slot).#ident` is valid. +// - `make_field_check` checks that `&raw mut (*slot).#ident` is properly aligned. +// - `(*slot).#ident` has been initialized above. +// - We only need the ownership to the pointee back when initialization has +// succeeded, where we `forget` the guard. +let mut #guard =unsafe { ::pin_init::__internal::DropGuard ::new ( ::core::ptr::addr_of_mut!((*slot).#ident) ) }; + + #(#cfgs)* +#[allow(unused_variables)] +let #ident = #accessor; }); guards.push (guard); guard_attrs.push (cfgs);
rust/pin-init/src/__internal.rs +19 -9
@@ -238,32 +238,42 @@ fn stack_init_reuse() {/// When a value of this type is dropped, it drops a `T`. /// /// Can be forgotten to prevent the drop. +/// +/// # Invariants +/// +/// - `ptr` is valid and properly aligned. +/// - `*ptr` is initialized and owned by this guard. pub struct DropGuard <T : ?Sized > { ptr: *mut T , }impl <T : ?Sized >DropGuard <T > { -/// Creates a new [`DropGuard<T>`]. It will [`ptr::drop_in_place`] `ptr` when it gets dropped. +/// Creates a drop guard and transfer the ownership of the pointer content. /// -/// # Safety +/// The ownership is only relinguished if the guard is forgotten via [`core::mem::forget`]. /// -/// `ptr` must be a valid pointer. +/// # Safety /// -/// It is the callers responsibility that `self` will only get dropped if the pointee of `ptr`: -/// - has not been dropped, -/// - is not accessible by any other means, -/// - will not be dropped by any other means. +/// - `ptr` is valid and properly aligned. +/// - `*ptr` is initialized, and the ownership is transferred to this guard. #[inline] pub unsafe fn new (ptr: *mut T ) ->Self { +// INVARIANT: By safety requirement. Self { ptr } } + +/// Create a let binding for accessor use. +#[inline] +pub fn let_binding (&mut self) -> &mut T { +// SAFETY: Per type invariant. +unsafe { &mut *self.ptr } + } }impl <T : ?Sized >Drop for DropGuard <T > {#[inline] fn drop (&mut self) { -// SAFETY: A `DropGuard` can only be constructed using the unsafe `new` function -// ensuring that this operation is safe. +// SAFETY: `self.ptr` is valid, properly aligned and `*self.ptr` is owned by this guard. unsafe { ptr::drop_in_place (self.ptr) } } }
Greg Kroah-Hartman
maintainerPATCH 307/307 x86/CPU/AMD: Prevent improper isolation of shared resources in Zen2s op cache
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prathyushi Nangia <[email protected]>
commit c21b90f77687075115d989e53a8ec5e2bb427ab1 upstream.
Make sure resources are not improperly shared in the op cache and cause instruction corruption this way.
--- arch/x86/include/asm/msr-index.h | 3 ++- arch/x86/kernel/cpu/amd.c | 3 +++ tools/arch/x86/include/asm/msr-index.h | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-)
arch/x86/include/asm/msr-index.h +2 -1
@@ -796,9 +796,10 @@#define MSR_AMD64_LBR_SELECT 0xc000010e/* Zen4 */ -#define MSR_ZEN4_BP_CFG 0xc001102e +#define MSR_ZEN4_BP_CFG 0xc001102e#define MSR_ZEN4_BP_CFG_BP_SPEC_REDUCE_BIT 4#define MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT 5 +#define MSR_ZEN2_BP_CFG_BUG_FIX_BIT 33/* Fam 19h MSRs */ #define MSR_F19H_UMC_PERF_CTL 0xc0010800
arch/x86/kernel/cpu/amd.c +3 -0
@@ -988,6 +988,9 @@ static void init_amd_zen2(struct cpuinfo/* Correct misconfigured CPUID on some clients. */ clear_cpu_cap (c,X86_FEATURE_INVLPGB ); + +if (!cpu_has (c,X86_FEATURE_HYPERVISOR )) +msr_set_bit (MSR_ZEN4_BP_CFG ,MSR_ZEN2_BP_CFG_BUG_FIX_BIT ); }static void init_amd_zen3 (struct cpuinfo_x86 *c)
tools/arch/x86/include/asm/msr-index.h +2 -1
@@ -793,9 +793,10 @@#define MSR_AMD64_LBR_SELECT 0xc000010e/* Zen4 */ -#define MSR_ZEN4_BP_CFG 0xc001102e +#define MSR_ZEN4_BP_CFG 0xc001102e#define MSR_ZEN4_BP_CFG_BP_SPEC_REDUCE_BIT 4#define MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT 5 +#define MSR_ZEN2_BP_CFG_BUG_FIX_BIT 33/* Fam 19h MSRs */ #define MSR_F19H_UMC_PERF_CTL 0xc0010800
Greg Kroah-Hartman
maintainerPATCH 292/307 octeon_ep_vf: add NULL check for napi_build_skb()
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Carlier <[email protected]>
[ Upstream commit dd66b42854705e4e4ee7f14d260f86c578bed3e3 ]
napi_build_skb() can return NULL on allocation failure. In __octep_vf_oq_process_rx(), the result is used directly without a NULL check in both the single-buffer and multi-fragment paths, leading to a NULL pointer dereference.
Add NULL checks after both napi_build_skb() calls, properly advancing descriptors and consuming remaining fragments on failure.
--- drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c | 36 +++++++++++++++- 1 file changed, 34 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c +34 -2
@@ -409,10 +409,17 @@ static int __octep_vf_oq_process_rx(stru data_offset =OCTEP_VF_OQ_RESP_HW_SIZE ; rx_ol_flags =0 ; } - rx_bytes += buff_info->len; -if (buff_info->len <= oq->max_single_buffer_size) { skb =napi_build_skb ((void *)resp_hw,PAGE_SIZE ); +if (!skb) { + oq->stats->alloc_failures++; + desc_used++; + read_idx++; +if (read_idx == oq->max_count) + read_idx =0 ; +continue ; + } + rx_bytes += buff_info->len;skb_reserve (skb, data_offset);skb_put (skb, buff_info->len); read_idx++;
@@ -424,6 +431,31 @@ static int __octep_vf_oq_process_rx(struu16 data_len; skb =napi_build_skb ((void *)resp_hw,PAGE_SIZE ); +if (!skb) { + oq->stats->alloc_failures++; + desc_used++; + read_idx++; +if (read_idx == oq->max_count) + read_idx =0 ; + data_len = buff_info->len - oq->max_single_buffer_size; +while (data_len) { +dma_unmap_page (oq->dev, oq->desc_ring[read_idx].buffer_ptr, +PAGE_SIZE ,DMA_FROM_DEVICE ); + buff_info = (struct octep_vf_rx_buffer *) + &oq->buff_info[read_idx]; + buff_info->page =NULL ; +if (data_len < oq->buffer_size) + data_len =0 ; +else + data_len -= oq->buffer_size; + desc_used++; + read_idx++; +if (read_idx == oq->max_count) + read_idx =0 ; + } +continue ; + } + rx_bytes += buff_info->len;skb_reserve (skb, data_offset);/* Head fragment includes response header(s); * subsequent fragments contains only data.
Greg Kroah-Hartman
maintainerPATCH 293/307 mmc: core: Adjust MDT beyond 2025
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avri Altman <[email protected]>
[ Upstream commit 3e487a634bc019166e452ea276f7522710eda9f4 ]
JEDEC JESD84-B51B which was released in September 2025, increases the manufacturing year limit for eMMC devices. The eMMC manufacturing year is stored in a 4-bit field in the CID register. Originally, it covered 1997–2012. Later, with EXT_CSD_REV=8, it was extended up to 2025. Now, with EXT_CSD_REV=9, the range is rolled over by another 16 years, up to 2038.
The mapping is as follows:
cid[8..11] | rev ≤ 4 | 8 ≥ rev > 4 | rev > 8
---------------------------------------------
0 | 1997 | 2013 | 2029 1 | 1998 | 2014 | 2030 2 | 1999 | 2015 | 2031 3 | 2000 | 2016 | 2032 4 | 2001 | 2017 | 2033 5 | 2002 | 2018 | 2034 6 | 2003 | 2019 | 2035 7 | 2004 | 2020 | 2036 8 | 2005 | 2021 | 2037 9 | 2006 | 2022 | 2038 10 | 2007 | 2023 | 11 | 2008 | 2024 | 12 | 2009 | 2025 | 13 | 2010 | | 2026 14 | 2011 | | 2027 15 | 2012 | | 2028
Stable-dep-of: d6bf2e64dec8 ("mmc: core: Optimize time for secure erase/trim for some Kingston eMMCs")
--- drivers/mmc/core/mmc.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/mmc/core/mmc.c +7 -0
@@ -671,7 +671,14 @@ static int mmc_decode_ext_csd(struct mmc card->ext_csd.enhanced_rpmb_supported = (card->ext_csd.rel_param &EXT_CSD_WR_REL_PARAM_EN_RPMB_REL_WR ); + +if (card->ext_csd.rev >=9 ) { +/* Adjust production date as per JEDEC JESD84-B51B September 2025 */ +if (card->cid.year <2023 ) + card->cid.year +=16 ; + } } + out:return err; }
Greg Kroah-Hartman
maintainerPATCH 294/307 mmc: core: Add quirk for incorrect manufacturing date
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avri Altman <[email protected]>
[ Upstream commit 263ff314cc5602599d481b0912a381555fcbad28 ]
Some eMMC vendors need to report manufacturing dates beyond 2025 but are reluctant to update the EXT_CSD revision from 8 to 9. Changing the Updating the EXT_CSD revision may involve additional testing or qualification steps with customers. To ease this transition and avoid a full re-qualification process, a workaround is needed. This patch introduces a temporary quirk that re-purposes the year codes corresponding to 2010, 2011, and 2012 to represent the years 2026, 2027, and 2028, respectively. This solution is only valid for this three-year period.
After 2028, vendors must update their firmware to set EXT_CSD_REV=9 to continue reporting the correct manufacturing date in compliance with the JEDEC standard.
The MMC_QUIRK_BROKEN_MDT is introduced and enabled for all Sandisk devices to handle this behavior.
Stable-dep-of: d6bf2e64dec8 ("mmc: core: Optimize time for secure erase/trim for some Kingston eMMCs")
--- drivers/mmc/core/card.h | 6 ++++++ drivers/mmc/core/mmc.c | 5 +++++ drivers/mmc/core/quirks.h | 3 +++ include/linux/mmc/card.h | 1 + 4 files changed, 15 insertions(+)
drivers/mmc/core/card.h +6 -0
@@ -89,6 +89,7 @@ struct mmc_fixup {#define CID_MANFID_MICRON 0x13#define CID_MANFID_SAMSUNG 0x15#define CID_MANFID_APACER 0x27 +#define CID_MANFID_SANDISK_MMC 0x45#define CID_MANFID_SWISSBIT 0x5D#define CID_MANFID_KINGSTON 0x70#define CID_MANFID_HYNIX 0x90
@@ -305,4 +306,9 @@ static inline int mmc_card_no_uhs_ddr50_ return c->quirks & MMC_QUIRK_NO_UHS_DDR50_TUNING; } +static inline int mmc_card_broken_mdt (const struct mmc_card *c) +{ +return c->quirks &MMC_QUIRK_BROKEN_MDT ; +} +#endif
drivers/mmc/core/mmc.c +5 -0
@@ -676,6 +676,11 @@ static int mmc_decode_ext_csd(struct mmc/* Adjust production date as per JEDEC JESD84-B51B September 2025 */ if (card->cid.year <2023 ) card->cid.year +=16 ; + }else { +/* Handle vendors with broken MDT reporting */ +if (mmc_card_broken_mdt (card) && card->cid.year >=2010 && + card->cid.year <=2012 ) + card->cid.year +=16 ; } }
drivers/mmc/core/quirks.h +3 -0
@@ -170,6 +170,9 @@ static const struct mmc_fixup __maybe_unMMC_FIXUP_EXT_CSD_REV (CID_NAME_ANY ,CID_MANFID_NUMONYX ,0x014e , add_quirk,MMC_QUIRK_BROKEN_HPI ,6 ), +MMC_FIXUP (CID_NAME_ANY ,CID_MANFID_SANDISK_MMC ,CID_OEMID_ANY , add_quirk_mmc, +MMC_QUIRK_BROKEN_MDT ), + END_FIXUP };
include/linux/mmc/card.h +1 -0
@@ -329,6 +329,7 @@ struct mmc_card {#define MMC_QUIRK_BROKEN_CACHE_FLUSH (1<<16)/* Don't flush cache until the write has occurred */ #define MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY (1<<17)/* Disable broken SD poweroff notify support */ #define MMC_QUIRK_NO_UHS_DDR50_TUNING (1<<18)/* Disable DDR50 tuning */ +#define MMC_QUIRK_BROKEN_MDT (1<<19)/* Wrong manufacturing year */ bool written_flag;/* Indicates eMMC has been written since power on */ bool reenable_cmdq;/* Re-enable Command Queue */
Greg Kroah-Hartman
maintainerPATCH 295/307 mmc: core: Optimize time for secure erase/trim for some Kingston eMMCs
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luke Wang <[email protected]>
[ Upstream commit d6bf2e64dec87322f2b11565ddb59c0e967f96e3 ]
Kingston eMMC IY2964 and IB2932 takes a fixed ~2 seconds for each secure erase/trim operation regardless of size - that is, a single secure erase/trim operation of 1MB takes the same time as 1GB. With default calculated 3.5MB max discard size, secure erase 1GB requires ~300 separate operations taking ~10 minutes total.
Add a card quirk, MMC_QUIRK_FIXED_SECURE_ERASE_TRIM_TIME, to set maximum secure erase size for those devices. This allows 1GB secure erase to complete in a single operation, reducing time from 10 minutes to just 2 seconds.
--- drivers/mmc/core/card.h | 5 +++++ drivers/mmc/core/queue.c | 9 +++++++-- drivers/mmc/core/quirks.h | 9 +++++++++ include/linux/mmc/card.h | 1 + 4 files changed, 22 insertions(+), 2 deletions(-)
drivers/mmc/core/card.h +5 -0
@@ -311,4 +311,9 @@ static inline int mmc_card_broken_mdt(co return c->quirks & MMC_QUIRK_BROKEN_MDT; } +static inline int mmc_card_fixed_secure_erase_trim_time (const struct mmc_card *c) +{ +return c->quirks &MMC_QUIRK_FIXED_SECURE_ERASE_TRIM_TIME ; +} +#endif
drivers/mmc/core/queue.c +7 -2
@@ -184,8 +184,13 @@ static void mmc_queue_setup_discard(strureturn ; lim->max_hw_discard_sectors = max_discard; -if (mmc_card_can_secure_erase_trim (card)) - lim->max_secure_erase_sectors = max_discard; +if (mmc_card_can_secure_erase_trim (card)) { +if (mmc_card_fixed_secure_erase_trim_time (card)) + lim->max_secure_erase_sectors =UINT_MAX >> card->erase_shift; +else + lim->max_secure_erase_sectors = max_discard; + } +if (mmc_card_can_trim (card) && card->erased_byte ==0 ) lim->max_write_zeroes_sectors = max_discard;
drivers/mmc/core/quirks.h +9 -0
@@ -153,6 +153,15 @@ static const struct mmc_fixup __maybe_unMMC_FIXUP ("M62704" ,CID_MANFID_KINGSTON ,0x0100 , add_quirk_mmc,MMC_QUIRK_TRIM_BROKEN ), +/* +* On Some Kingston eMMCs, secure erase/trim time is independent +* of erase size, fixed at approximately 2 seconds. +*/ +MMC_FIXUP ("IY2964" ,CID_MANFID_KINGSTON ,0x0100 , add_quirk_mmc, +MMC_QUIRK_FIXED_SECURE_ERASE_TRIM_TIME ), +MMC_FIXUP ("IB2932" ,CID_MANFID_KINGSTON ,0x0100 , add_quirk_mmc, +MMC_QUIRK_FIXED_SECURE_ERASE_TRIM_TIME ), + END_FIXUP };
include/linux/mmc/card.h +1 -0
@@ -330,6 +330,7 @@ struct mmc_card {#define MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY (1<<17)/* Disable broken SD poweroff notify support */ #define MMC_QUIRK_NO_UHS_DDR50_TUNING (1<<18)/* Disable DDR50 tuning */ #define MMC_QUIRK_BROKEN_MDT (1<<19)/* Wrong manufacturing year */ +#define MMC_QUIRK_FIXED_SECURE_ERASE_TRIM_TIME (1<<20)/* Secure erase/trim time is fixed regardless of size */ bool written_flag;/* Indicates eMMC has been written since power on */ bool reenable_cmdq;/* Re-enable Command Queue */
Greg Kroah-Hartman
maintainerPATCH 296/307 crypto: qat - fix indentation of macros in qat_hal.c
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suman Kumar Chakraborty <[email protected]>
[ Upstream commit 4963b39e3a3feed07fbf4d5cc2b5df8498888285 ]
The macros in qat_hal.c were using a mixture of tabs and spaces. Update all macro indentation to use tabs consistently, matching the predominant style.
This does not introduce any functional change.
Stable-dep-of: e7dcb722bb75 ("crypto: qat - fix firmware loading failure for GEN6 devices")
--- drivers/crypto/intel/qat/qat_common/qat_hal.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/crypto/intel/qat/qat_common/qat_hal.c +11 -11
@@ -9,17 +9,17 @@#include "icp_qat_hal.h" #include "icp_qat_uclo.h" -#define BAD_REGADDR 0xffff -#define MAX_RETRY_TIMES 10000 -#define INIT_CTX_ARB_VALUE 0x0 -#define INIT_CTX_ENABLE_VALUE 0x0 -#define INIT_PC_VALUE 0x0 -#define INIT_WAKEUP_EVENTS_VALUE 0x1 -#define INIT_SIG_EVENTS_VALUE 0x1 -#define INIT_CCENABLE_VALUE 0x2000 -#define RST_CSR_QAT_LSB 20 -#define RST_CSR_AE_LSB 0 -#define MC_TIMESTAMP_ENABLE (0x1 << 7) +#define BAD_REGADDR 0xffff +#define MAX_RETRY_TIMES 10000 +#define INIT_CTX_ARB_VALUE 0x0 +#define INIT_CTX_ENABLE_VALUE 0x0 +#define INIT_PC_VALUE 0x0 +#define INIT_WAKEUP_EVENTS_VALUE 0x1 +#define INIT_SIG_EVENTS_VALUE 0x1 +#define INIT_CCENABLE_VALUE 0x2000 +#define RST_CSR_QAT_LSB 20 +#define RST_CSR_AE_LSB 0 +#define MC_TIMESTAMP_ENABLE (0x1 << 7)#define IGNORE_W1C_MASK ((~(1 << CE_BREAKPOINT_BITPOS)) & \ (~(1 << CE_CNTL_STORE_PARITY_ERROR_BITPOS)) & \
Greg Kroah-Hartman
maintainerPATCH 297/307 crypto: qat - fix firmware loading failure for GEN6 devices
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suman Kumar Chakraborty <[email protected]>
[ Upstream commit e7dcb722bb75bb3f3992f580a8728a794732fd7a ]
QAT GEN6 hardware requires a minimum 3 us delay during the acceleration engine reset sequence to ensure the hardware fully settles. Without this delay, the firmware load may fail intermittently.
Add a delay after placing the AE into reset and before clearing the reset, matching the hardware requirements and ensuring stable firmware loading. Earlier generations remain unaffected.
--- drivers/crypto/intel/qat/qat_common/adf_accel_engine.c | 7 +++++++ drivers/crypto/intel/qat/qat_common/icp_qat_fw_loader_handle.h | 1 + drivers/crypto/intel/qat/qat_common/qat_hal.c | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-)
drivers/crypto/intel/qat/qat_common/adf_accel_engine.c +7 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only) /* Copyright(c) 2014 - 2020 Intel Corporation */ +#include <linux/delay.h> #include <linux/firmware.h> #include <linux/pci.h> #include "adf_cfg.h"
@@ -162,8 +163,14 @@ int adf_ae_stop(struct adf_accel_dev *acstatic int adf_ae_reset (struct adf_accel_dev *accel_dev,int ae) {struct adf_fw_loader_data *loader_data = accel_dev->fw_loader; +unsigned long reset_delay;qat_hal_reset (loader_data->fw_loader); + + reset_delay = loader_data->fw_loader->chip_info->reset_delay_us; +if (reset_delay) +fsleep (reset_delay); +if (qat_hal_clr_reset (loader_data->fw_loader))return -EFAULT ;
drivers/crypto/intel/qat/qat_common/icp_qat_fw_loader_handle.h +1 -0
@@ -27,6 +27,7 @@ struct icp_qat_fw_loader_chip_info {int mmp_sram_size;bool nn;bool lm2lm3; +u16 reset_delay_us;u32 lm_size;u32 icp_rst_csr;u32 icp_rst_mask;
drivers/crypto/intel/qat/qat_common/qat_hal.c +4 -1
@@ -20,6 +20,7 @@#define RST_CSR_QAT_LSB 20#define RST_CSR_AE_LSB 0#define MC_TIMESTAMP_ENABLE (0x1 << 7) +#define MIN_RESET_DELAY_US 3#define IGNORE_W1C_MASK ((~(1 << CE_BREAKPOINT_BITPOS)) & \ (~(1 << CE_CNTL_STORE_PARITY_ERROR_BITPOS)) & \
@@ -713,8 +714,10 @@ static int qat_hal_chip_init(struct icp_ handle->chip_info->wakeup_event_val =0x80000000 ; handle->chip_info->fw_auth = true; handle->chip_info->css_3k = true; -if (handle->pci_dev->device ==PCI_DEVICE_ID_INTEL_QAT_6XXX ) +if (handle->pci_dev->device ==PCI_DEVICE_ID_INTEL_QAT_6XXX ) { handle->chip_info->dual_sign = true; + handle->chip_info->reset_delay_us =MIN_RESET_DELAY_US ; + } handle->chip_info->tgroup_share_ustore = true; handle->chip_info->fcu_ctl_csr =FCU_CONTROL_4XXX ; handle->chip_info->fcu_sts_csr =FCU_STATUS_4XXX ;
Greg Kroah-Hartman
maintainerPATCH 298/307 hfsplus: fix uninit-value by validating catalog record size
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
[ Upstream commit b6b592275aeff184aa82fcf6abccd833fb71b393 ]
Syzbot reported a KMSAN uninit-value issue in hfsplus_strcasecmp(). The root cause is that hfs_brec_read() doesn't validate that the on-disk record size matches the expected size for the record type being read.
When mounting a corrupted filesystem, hfs_brec_read() may read less data than expected. For example, when reading a catalog thread record, the debug output showed:
HFSPLUS_BREC_READ: rec_len=520, fd->entrylength=26
HFSPLUS_BREC_READ: WARNING - entrylength (26) < rec_len (520) - PARTIAL READ!
hfs_brec_read() only validates that entrylength is not greater than the buffer size, but doesn't check if it's less than expected. It successfully reads 26 bytes into a 520-byte structure and returns success, leaving 494 bytes uninitialized.
This uninitialized data in tmp.thread.nodeName then gets copied by hfsplus_cat_build_key_uni() and used by hfsplus_strcasecmp(), triggering the KMSAN warning when the uninitialized bytes are used as array indices in case_fold().
Fix by introducing hfsplus_brec_read_cat() wrapper that:
1. Calls hfs_brec_read() to read the data
2. Validates the record size based on the type field:
- Fixed size for folder and file records
- Variable size for thread records (depends on string length)
3. Returns -EIO if size doesn't match expected
For thread records, check against HFSPLUS_MIN_THREAD_SZ before reading nodeName.length to avoid reading uninitialized data at call sites that don't zero-initialize the entry structure.
Also initialize the tmp variable in hfsplus_find_cat() as defensive programming to ensure no uninitialized data even if validation is bypassed.
Stable-dep-of: 90c500e4fd83 ("hfsplus: fix held lock freed on hfsplus_fill_super()")
--- fs/hfsplus/bfind.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/hfsplus/catalog.c | 4 +-- fs/hfsplus/dir.c | 2 - fs/hfsplus/hfsplus_fs.h | 9 ++++++++ fs/hfsplus/super.c | 2 - 5 files changed, 64 insertions(+), 4 deletions(-)
fs/hfsplus/bfind.c +51 -0
@@ -287,3 +287,54 @@ out: fd->bnode = bnode;return res; } + +/** +* hfsplus_brec_read_cat - read and validate a catalog record +* @fd: find data structure +* @entry: pointer to catalog entry to read into +* +* Reads a catalog record and validates its size matches the expected +* size based on the record type. +* +* Returns 0 on success, or negative error code on failure. +*/ +int hfsplus_brec_read_cat (struct hfs_find_data *fd,hfsplus_cat_entry *entry) +{ +int res; +u32 expected_size; + + res =hfs_brec_read (fd, entry,sizeof (hfsplus_cat_entry)); +if (res) +return res; + +/* Validate catalog record size based on type */ +switch (be16_to_cpu (entry->type)) { +case HFSPLUS_FOLDER : + expected_size =sizeof (struct hfsplus_cat_folder ); +break ; +case HFSPLUS_FILE : + expected_size =sizeof (struct hfsplus_cat_file ); +break ; +case HFSPLUS_FOLDER_THREAD : +case HFSPLUS_FILE_THREAD : +/* Ensure we have at least the fixed fields before reading nodeName.length */ +if (fd->entrylength <HFSPLUS_MIN_THREAD_SZ ) { +pr_err ("thread record too short (got %u)\n" , fd->entrylength); +return -EIO ; + } + expected_size =hfsplus_cat_thread_size (&entry->thread); +break ; +default : +pr_err ("unknown catalog record type %d\n" , +be16_to_cpu (entry->type)); +return -EIO ; + } + +if (fd->entrylength != expected_size) { +pr_err ("catalog record size mismatch (type %d, got %u, expected %u)\n" , +be16_to_cpu (entry->type), fd->entrylength, expected_size); +return -EIO ; + } + +return 0 ; +}
fs/hfsplus/catalog.c +2 -2
@@ -194,12 +194,12 @@ static int hfsplus_fill_cat_thread(strucint hfsplus_find_cat (struct super_block *sb,u32 cnid,struct hfs_find_data *fd) { -hfsplus_cat_entry tmp; +hfsplus_cat_entry tmp = {0 };int err;u16 type;hfsplus_cat_build_key_with_cnid (sb, fd->search_key, cnid); - err =hfs_brec_read (fd, &tmp,sizeof (hfsplus_cat_entry)); + err =hfsplus_brec_read_cat (fd, &tmp);if (err)return err;
fs/hfsplus/dir.c +1 -1
@@ -49,7 +49,7 @@ static struct dentry *hfsplus_lookup(strif (unlikely (err <0 )) goto fail; again: - err =hfs_brec_read (&fd, &entry,sizeof (entry)); + err =hfsplus_brec_read_cat (&fd, &entry);if (err) {if (err == -ENOENT ) {hfs_find_exit (&fd);
fs/hfsplus/hfsplus_fs.h +9 -0
@@ -509,6 +509,15 @@ int hfsplus_submit_bio(struct super_bloc void **data, blk_opf_t opf);int hfsplus_read_wrapper (struct super_block *sb); +static inline u32 hfsplus_cat_thread_size (const struct hfsplus_cat_thread *thread) +{ +return offsetof(struct hfsplus_cat_thread , nodeName) + + offsetof(struct hfsplus_unistr , unicode) + +be16_to_cpu (thread->nodeName.length) *sizeof (hfsplus_unichr); +} + +int hfsplus_brec_read_cat (struct hfs_find_data *fd,hfsplus_cat_entry *entry); +/* * time helpers: convert between 1904-base and 1970-base timestamps *
fs/hfsplus/super.c +1 -1
@@ -571,7 +571,7 @@ static int hfsplus_fill_super(struct sup err =hfsplus_cat_build_key (sb, fd.search_key,HFSPLUS_ROOT_CNID , &str);if (unlikely (err <0 )) goto out_put_root; -if (!hfs_brec_read (&fd, &entry,sizeof (entry))) { +if (!hfsplus_brec_read_cat (&fd, &entry)) {hfs_find_exit (&fd);if (entry.type !=cpu_to_be16 (HFSPLUS_FOLDER )) { err = -EIO ;
Greg Kroah-Hartman
maintainerPATCH 299/307 hfsplus: fix held lock freed on hfsplus_fill_super()
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zilin Guan <[email protected]>
[ Upstream commit 90c500e4fd83fa33c09bc7ee23b6d9cc487ac733 ]
hfsplus_fill_super() calls hfs_find_init() to initialize a search structure, which acquires tree->tree_lock. If the subsequent call to hfsplus_cat_build_key() fails, the function jumps to the out_put_root error label without releasing the lock. The later cleanup path then frees the tree data structure with the lock still held, triggering a held lock freed warning.
Fix this by adding the missing hfs_find_exit(&fd) call before jumping to the out_put_root error label. This ensures that tree->tree_lock is properly released on the error path.
The bug was originally detected on v6.13-rc1 using an experimental static analysis tool we are developing, and we have verified that the issue persists in the latest mainline kernel. The tool is specifically designed to detect memory management issues. It is currently under active development and not yet publicly available.
We confirmed the bug by runtime testing under QEMU with x86_64 defconfig, lockdep enabled, and CONFIG_HFSPLUS_FS=y. To trigger the error path, we used GDB to dynamically shrink the max_unistr_len parameter to 1 before hfsplus_asc2uni() is called. This forces hfsplus_asc2uni() to naturally return -ENAMETOOLONG, which propagates to hfsplus_cat_build_key() and exercises the faulty error path. The following warning was observed during mount:
=========================
WARNING: held lock freed!
7.0.0-rc3-00016-gb4f0dd314b39 #4 Not tainted
-------------------------
mount/174 is freeing memory ffff888103f92000-ffff888103f92fff, with a lock still held there!
ffff888103f920b0 (&tree->tree_lock){+.+.}-{4:4}, at: hfsplus_find_init+0x154/0x1e0
2 locks held by mount/174:
#0: ffff888103f960e0 (&type->s_umount_key#42/1){+.+.}-{4:4}, at: alloc_super.constprop.0+0x167/0xa40
#1: ffff888103f920b0 (&tree->tree_lock){+.+.}-{4:4}, at: hfsplus_find_init+0x154/0x1e0
stack backtrace:
CPU: 2 UID: 0 PID: 174 Comm: mount Not tainted 7.0.0-rc3-00016-gb4f0dd314b39 #4 PREEMPT(lazy)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x82/0xd0
debug_check_no_locks_freed+0x13a/0x180
kfree+0x16b/0x510
? hfsplus_fill_super+0xcb4/0x18a0
hfsplus_fill_super+0xcb4/0x18a0
? __pfx_hfsplus_fill_super+0x10/0x10
? srso_return_thunk+0x5/0x5f
? bdev_open+0x65f/0xc30
? srso_return_thunk+0x5/0x5f
? pointer+0x4ce/0xbf0
? trace_contention_end+0x11c/0x150
? __pfx_pointer+0x10/0x10
? srso_return_thunk+0x5/0x5f
? bdev_open+0x79b/0xc30
? srso_return_thunk+0x5/0x5f
? srso_return_thunk+0x5/0x5f
? vsnprintf+0x6da/0x1270
? srso_return_thunk+0x5/0x5f
? __mutex_unlock_slowpath+0x157/0x740
? __pfx_vsnprintf+0x10/0x10
? srso_return_thunk+0x5/0x5f
? srso_return_thunk+0x5/0x5f
? mark_held_locks+0x49/0x80
? srso_return_thunk+0x5/0x5f
? srso_return_thunk+0x5/0x5f
? irqentry_exit+0x17b/0x5e0
? trace_irq_disable.constprop.0+0x116/0x150
? __pfx_hfsplus_fill_super+0x10/0x10
? __pfx_hfsplus_fill_super+0x10/0x10
get_tree_bdev_flags+0x302/0x580
? __pfx_get_tree_bdev_flags+0x10/0x10
? vfs_parse_fs_qstr+0x129/0x1a0
? __pfx_vfs_parse_fs_qstr+0x3/0x10
vfs_get_tree+0x89/0x320
fc_mount+0x10/0x1d0
path_mount+0x5c5/0x21c0
? __pfx_path_mount+0x10/0x10
? trace_irq_enable.constprop.0+0x116/0x150
? trace_irq_enable.constprop.0+0x116/0x150
? srso_return_thunk+0x5/0x5f
? srso_return_thunk+0x5/0x5f
? kmem_cache_free+0x307/0x540
? user_path_at+0x51/0x60
? __x64_sys_mount+0x212/0x280
? srso_return_thunk+0x5/0x5f
__x64_sys_mount+0x212/0x280
? __pfx___x64_sys_mount+0x10/0x10
? srso_return_thunk+0x5/0x5f
? trace_irq_enable.constprop.0+0x116/0x150
? srso_return_thunk+0x5/0x5f
do_syscall_64+0x111/0x680
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ffacad55eae
Code: 48 8b 0d 85 1f 0f 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 a5 00 00 8
RSP: 002b:00007fff1ab55718 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ffacad55eae
RDX: 000055740c64e5b0 RSI: 000055740c64e630 RDI: 000055740c651ab0
RBP: 000055740c64e380 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000055740c64e5b0 R14: 000055740c651ab0 R15: 000055740c64e380
</TASK>After applying this patch, the warning no longer appears.
--- fs/hfsplus/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/hfsplus/super.c +3 -1
@@ -569,8 +569,10 @@ static int hfsplus_fill_super(struct supif (err) goto out_put_root; err =hfsplus_cat_build_key (sb, fd.search_key,HFSPLUS_ROOT_CNID , &str); -if (unlikely (err <0 )) +if (unlikely (err <0 )) { +hfs_find_exit (&fd); goto out_put_root; + }if (!hfsplus_brec_read_cat (&fd, &entry)) {hfs_find_exit (&fd);if (entry.type !=cpu_to_be16 (HFSPLUS_FOLDER )) {
Greg Kroah-Hartman
maintainerPATCH 290/307 LoongArch: Use per-root-bridge PCIH flag to skip mem resource fixup
In reply to Greg Kroah-Hartman7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 49f33840dcc907d21313d369e34872880846b61c upstream.
When firmware enables 64-bit PCI host bridge support, some root bridges already provide valid 64-bit mem resource windows through ACPI.
In this case, the LoongArch-specific mem resource high-bits fixup in acpi_prepare_root_resources() should not be applied unconditionally. Otherwise, the kernel may override the native resource layout derived from firmware, and later BAR assignment can fail to place device BARs into the intended 64-bit address space correctly.
Add a per-root-bridge ACPI flag, PCIH, and evaluate it from the current root bridge device scope. When PCIH is set, skip the mem resource high- bits fixup path and let the kernel use the firmware-provided resource description directly. When PCIH is absent or cleared, keep the existing behavior and continue filling the high address bits from the host bridge address.
This makes the behavior per-root-bridge configurable and avoids breaking valid 64-bit BAR space allocation on bridges whose 64-bit windows have already been fully described by firmware.
--- arch/loongarch/pci/acpi.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/loongarch/pci/acpi.c +5 -0
@@ -61,11 +61,16 @@ static void acpi_release_root_info(strucstatic int acpi_prepare_root_resources (struct acpi_pci_root_info *ci) {int status; +unsigned long long pci_h =0 ;struct resource_entry *entry, *tmp;struct acpi_device *device = ci->bridge; status =acpi_pci_probe_root_resources (ci);if (status >0 ) { +acpi_evaluate_integer (device->handle,"PCIH" ,NULL , &pci_h); +if (pci_h) +return status; +resource_list_for_each_entry_safe (entry, tmp, &ci->resources) {if (entry->res->flags &IORESOURCE_MEM ) { entry->offset = ci->root->mcfg_addr &GENMASK_ULL (63 ,40 );
Hi
7.0.7-rc1 does not compile !
=======
error:
In file included from kernel/sched/build_policy.c:62:kernel/sched/ext.c: In function ‘bypass_lb_cpu’:kernel/sched/ext.c:4019:35: error: ‘donor_rq’ undeclared (first use in this function); did you mean ‘donee_rq’?
4019 | if (task_rq(p) != donor_rq)
| ^~~~~~~~
| donee_rqkernel/sched/ext.c:4019:35: note: each undeclared identifier is reported only once for each function it appears in make[4]: *** [scripts/Makefile.build:289: kernel/sched/build_policy.o] Error 1
make[3]: *** [scripts/Makefile.build:548: kernel/sched] Error 2
make[2]: *** [scripts/Makefile.build:548: kernel] Error 2
make[2]: *** Waiting for unfinished jobs....
========
if I do
git revert eb5b997dadc51746b5db031be1e9e7c19646c317 --no-edit
(NOT bisected just reading through the patches !)
I find no regressions here on x86_64 (Intel 11th Gen. CPU)
Thanks
Re: [PATCH 7.0 040/307] usb: typec: tcpm: reset internal port states on soft reset AMS
In reply to Greg Kroah-HartmanHi Greg,
Quoted 76 lines · Greg Kroah-Hartman
7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amit Sunil Dhamne <[email protected]>
commit
2909f0d4994fb4306bf116df5ccee797791fce2cupstream.Reset internal port states (such as
vdm_sm_runningandexplicit_contract) on soft reset AMS as the port needs to negotiate a new contract. The consequence of leaving the states in as-is cond are as follows:
* port is in SRC power role and an explicit contract is negotiated with the port partner (in sink role)
* port partner sends a Soft Reset AMS while VDM State Machine is running
* port accepts the Soft Reset request and the port advertises src caps
* port partner sends a Request message but since theexplicit_contractandvdm_sm_runningare true from previous negotiation, the port ends up sending Soft Reset instead of Accept msg.Stub Log:
[ 203.653942] AMS DISCOVER_IDENTITY start [ 203.653947] PD TX, header: 0x176f [ 203.655901] PD TX complete, status: 0 [ 203.657470] PD RX, header: 0x124f [1] [ 203.657477] Rx VDM cmd 0xff008081 type 2 cmd 1 len 1 [ 203.657482] AMS DISCOVER_IDENTITY finished [ 203.657484] cc:=4 [ 204.155698] PD RX, header: 0x144f [1] [ 204.155718] Rx VDM cmd 0xeeee8001 type 0 cmd 1 len 1 [ 204.155741] PD TX, header: 0x196f [ 204.157622] PD TX complete, status: 0 [ 204.160060] PD RX, header: 0x4d [1] [ 204.160066] state change SRC_READY -> SOFT_RESET [rev2 SOFT_RESET_AMS] [ 204.160076] PD TX, header: 0x163 [ 204.162486] PD TX complete, status: 0 [ 204.162832] AMS SOFT_RESET_AMS finished [ 204.162840] cc:=4 [ 204.162891] AMS POWER_NEGOTIATION start [ 204.162896] state change SOFT_RESET -> AMS_START [rev2 POWER_NEGOTIATION] [ 204.162908] state change AMS_START -> SRC_SEND_CAPABILITIES [rev2 POWER_NEGOTIATION] [ 204.162913] PD TX, header: 0x1361 [ 204.165529] PD TX complete, status: 0 [ 204.165571] pending state change SRC_SEND_CAPABILITIES -> SRC_SEND_CAPABILITIES_TIMEOUT @ 60 ms [rev2 POWER_NEGOTIATION] [ 204.166996] PD RX, header: 0x1242 [1] [ 204.167009] state change SRC_SEND_CAPABILITIES -> SRC_SOFT_RESET_WAIT_SNK_TX [rev2 POWER_NEGOTIATION] [ 204.167019] AMS POWER_NEGOTIATION finished [ 204.167020] cc:=4 [ 204.167083] AMS SOFT_RESET_AMS start [ 204.167086] state change SRC_SOFT_RESET_WAIT_SNK_TX -> SOFT_RESET_SEND [rev2 SOFT_RESET_AMS] [ 204.167092] PD TX, header: 0x16d [ 204.168824] PD TX complete, status: 0 [ 204.168854] pending state change SOFT_RESET_SEND -> HARD_RESET_SEND @ 60 ms [rev2 SOFT_RESET_AMS] [ 204.171876] PD RX, header: 0x43 [1] [ 204.171879] AMS SOFT_RESET_AMS finishedThis causes COMMON.PROC.PD.11.2 check failure for TEST.PD.VDM.SRC.2_Rev2Src test on the PD compliance tester.
Signed-off-by Amit Sunil Dhamne <[email protected]>Fixes 8d3a0578ad1a ("usb: typec: tcpm: Respond Wait if VDM state machine is running")Fixes f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)")Cc stable <[email protected]>Reviewed-by Badhri Jagan Sridharan <[email protected]>Acked-by Heikki Krogerus <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/usb/typec/tcpm/tcpm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/typec/tcpm/tcpm.c static void run_state_machine(struct tcp · line 5745
Quoted 5 lines
drivers/usb/typec/tcpm/tcpm.c +2
-0@@ -5741,6 +5741,8 @@ static void run_state_machine(struct tcpcase VCONN_SWAP_ACCEPT :tcpm_pd_send_control (port,PD_CTRL_ACCEPT ,TCPC_TX_SOP ); + port->vdm_sm_running = false; + port->explicit_contract = false;
Please drop this patch from the queue. It was incorrectly applied to the VCONN_SWAP_ACCEPT case instead of the soft reset handling due to context fuzz. I will send a proper rebased backport for the 7.0 stable tree shortly.
Thanks,
Amit
Quoted 1 line
Hi Greg
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.0.7 release. There are 307 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 Thu, 14 May 2026 17:38:03 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.0.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.0.y
and the diffstat can be found below.thanks,
greg k-h
Linux version 7.0.7-rc1 tested.
Build error.
Error log (some output is in the native language (Japanese))
CC kernel/sched/build_policy.o
In file included from kernel/sched/build_policy.c:62:kernel/sched/ext.c: 関数 ‘bypass_lb_cpu’ 内:kernel/sched/ext.c:4019:35: error: ‘donor_rq’ undeclared (first use in this function); did you mean ‘donee_rq’?
4019 | if (task_rq(p) != donor_rq)
| ^~~~~~~~
| donee_rqkernel/sched/ext.c:4019:35: note: 未宣言の識別子は出現した各関数内で一回のみ報告されます make[4]: *** [scripts/Makefile.build:289: kernel/sched/build_policy.o] エラー 1 make[3]: *** [scripts/Makefile.build:548: kernel/sched] エラー 2 make[2]: *** [scripts/Makefile.build:548: kernel] エラー 2
make[1]: *** [/home/takeshi/kernelbuild/linux-stable-rc/Makefile:2108: .] エラー 2
make: *** [Makefile:248: __sub-make] エラー 2
Following the error log, I corrected line 4019 and tried building again, and this time the build was successful.
We successfully booted and tested the modified kernel.
Due to time constraints, I omitted the investigation using git bisect, but the suspected commits are presumed to be the following. eb5b997dadc51746b5db031be1e9e7c19646c317
Thanks
Hi Greg,
Am 12.05.2026 um 19:36 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 7.0.7 release. There are 307 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.
Trying to build 7.0.7-rc1, I get this build error.
In file included from kernel/sched/build_policy.c:62:kernel/sched/ext.c: In function ‘bypass_lb_cpu’:kernel/sched/ext.c:4019:35: error: ‘donor_rq’ undeclared (first use in this function); did you mean ‘donee_rq’?
4019 | if (task_rq(p) != donor_rq)
| ^~~~~~~~
| donee_rqkernel/sched/ext.c:4019:35: note: each undeclared identifier is reported only once for each function it appears in make[4]: *** [scripts/Makefile.build:289: kernel/sched/build_policy.o] Fehler 1
make[3]: *** [scripts/Makefile.build:548: kernel/sched] Fehler 2
make[2]: *** [scripts/Makefile.build:548: kernel] Fehler 2
make[1]: *** [/usr/src/linux-stable-rc/Makefile:2108: .] Fehler 2
make: *** [Makefile:248: __sub-make] Fehler 2
root@linus:/usr/src/linux-stable-rc#
The offending line seems to be part of eb5b997dadc517 (sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu()) Adding Tejun and Andrea to CC.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Re: [PATCH 7.0 247/307] sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu()
In reply to Greg Kroah-HartmanQuoted 30 lines · Greg Kroah-Hartman
7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit
da2d81b4118a74e65d2335e221a38d665902a98cupstream.
bypass_lb_cpu()transfers tasks between per-CPU bypass DSQs without migrating them -task_cpu()only updates when the donee later consumes the task viamove_remote_task_to_local_dsq(). If the LB timer fires again before consumption and the new DSQ becomes a donor, @p is still on the previous CPU andtask_rq(@p)!=donor_rq. @p can't be moved without its own rq locked.Skip such tasks.
Fixes 95d1df610cdc ("sched_ext: Implement load balancer for bypass mode")Cc [email protected] # v6.19+Reported-by Chris Mason <[email protected]>Signed-off-by Tejun Heo <[email protected]>Reviewed-by Andrea Righi <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- kernel/sched/ext.c | 9 +++++++++ 1 file changed, 9 insertions(+)kernel/sched/ext.c +0
-0@@ -4008,6 +4008,15 @@ resume:if (cpumask_empty (donee_mask))
kernel/sched/ext.c resume: · line 4018
Quoted 10 lines
kernel/sched/ext.c +8
-0break ; +/* +* If an earlier pass placed @p on @donor_dsq from a different +* CPU and the donee hasn't consumed it yet, @p is still on the +* previous CPU and task_rq(@p) != @donor_rq. @p can't be moved +* without its rq locked. Skip. +*/ +if (task_rq (p) != donor_rq) +continue ;
As others pointed out already:
[ 75s] In file included from ../kernel/sched/build_policy.c:62: [ 75s] ../kernel/sched/ext.c: In function ‘bypass_lb_cpu’: [ 75s] ../kernel/sched/ext.c:4019:35: error: ‘donor_rq’ undeclared (first use in this function); did you mean ‘donee_rq’? [ 75s] 4019 | if (task_rq(p) != donor_rq) [ 75s] | ^~~~~~~~ [ 75s] | donee_rq
Donor and donor_rq were introduced in:
commit ff06f727a9412b3c9f2f13f1441a5a0d2a31366b
Author: Tejun Heo <[email protected]> Date: Fri Mar 6 07:58:03 2026 -1000
sched_ext: Move bypass_dsq into scx_sched_pcpu
thanks,
Signature · 2 lines
js suse labs
PATCH 1/1 usb: typec: tcpm: reset internal port states on soft reset AMS
In reply to Greg Kroah-HartmanReset internal port states (such as vdm_sm_running and explicit_contract) on soft reset AMS as the port needs to negotiate a new contract. The consequence of leaving the states in as-is cond are as follows:
* port is in SRC power role and an explicit contract is negotiated with the port partner (in sink role)
* port partner sends a Soft Reset AMS while VDM State Machine is running
* port accepts the Soft Reset request and the port advertises src caps
* port partner sends a Request message but since the explicit_contract and vdm_sm_running are true from previous negotiation, the port ends up sending Soft Reset instead of Accept msg.
Stub Log:
[ 203.653942] AMS DISCOVER_IDENTITY start [ 203.653947] PD TX, header: 0x176f [ 203.655901] PD TX complete, status: 0 [ 203.657470] PD RX, header: 0x124f [1] [ 203.657477] Rx VDM cmd 0xff008081 type 2 cmd 1 len 1 [ 203.657482] AMS DISCOVER_IDENTITY finished [ 203.657484] cc:=4 [ 204.155698] PD RX, header: 0x144f [1] [ 204.155718] Rx VDM cmd 0xeeee8001 type 0 cmd 1 len 1 [ 204.155741] PD TX, header: 0x196f [ 204.157622] PD TX complete, status: 0 [ 204.160060] PD RX, header: 0x4d [1] [ 204.160066] state change SRC_READY -> SOFT_RESET [rev2 SOFT_RESET_AMS] [ 204.160076] PD TX, header: 0x163 [ 204.162486] PD TX complete, status: 0 [ 204.162832] AMS SOFT_RESET_AMS finished [ 204.162840] cc:=4 [ 204.162891] AMS POWER_NEGOTIATION start [ 204.162896] state change SOFT_RESET -> AMS_START [rev2 POWER_NEGOTIATION] [ 204.162908] state change AMS_START -> SRC_SEND_CAPABILITIES [rev2 POWER_NEGOTIATION] [ 204.162913] PD TX, header: 0x1361 [ 204.165529] PD TX complete, status: 0 [ 204.165571] pending state change SRC_SEND_CAPABILITIES -> SRC_SEND_CAPABILITIES_TIMEOUT @ 60 ms [rev2 POWER_NEGOTIATION] [ 204.166996] PD RX, header: 0x1242 [1] [ 204.167009] state change SRC_SEND_CAPABILITIES -> SRC_SOFT_RESET_WAIT_SNK_TX [rev2 POWER_NEGOTIATION] [ 204.167019] AMS POWER_NEGOTIATION finished [ 204.167020] cc:=4 [ 204.167083] AMS SOFT_RESET_AMS start [ 204.167086] state change SRC_SOFT_RESET_WAIT_SNK_TX -> SOFT_RESET_SEND [rev2 SOFT_RESET_AMS] [ 204.167092] PD TX, header: 0x16d [ 204.168824] PD TX complete, status: 0 [ 204.168854] pending state change SOFT_RESET_SEND -> HARD_RESET_SEND @ 60 ms [rev2 SOFT_RESET_AMS] [ 204.171876] PD RX, header: 0x43 [1] [ 204.171879] AMS SOFT_RESET_AMS finished
This causes COMMON.PROC.PD.11.2 check failure for TEST.PD.VDM.SRC.2_Rev2Src test on the PD compliance tester.
--- drivers/usb/typec/tcpm/tcpm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +2 -0
@@ -5534,6 +5534,8 @@ static void run_state_machine(struct tcpm_port *port)usb_power_delivery_unregister_capabilities (port->partner_source_caps); port->partner_source_caps =NULL ;tcpm_pd_send_control (port,PD_CTRL_ACCEPT ,TCPC_TX_SOP ); + port->vdm_sm_running = false; + port->explicit_contract = false;tcpm_ams_finish (port);if (port->pwr_role ==TYPEC_SOURCE ) { port->upcoming_state =SRC_SEND_CAPABILITIES ;
Signature · 1 line
2.54.0.563.g4f69b47b94-goog
Hello,
Quoted 24 lines · Peter Schneider
Hi Greg,
Am 12.05.2026 um 19:36 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 7.0.7 release. There are 307 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.
Trying to build 7.0.7-rc1, I get this build error.
In file included from
kernel/sched/build_policy.c:62:kernel/sched/ext.c: In function ‘bypass_lb_cpu’:kernel/sched/ext.c:4019:35: error: ‘donor_rq’ undeclared (first use in this function); did you mean ‘donee_rq’?4019 | if (task_rq(p) != donor_rq) | ^~~~~~~~ | donee_rq
kernel/sched/ext.c:4019:35: note: each undeclared identifier is reported only once for each function it appears in make[4]: *** [scripts/Makefile.build:289:kernel/sched/build_policy.o] Fehler 1
make[3]: *** [scripts/Makefile.build:548: kernel/sched] Fehler 2
make[2]: *** [scripts/Makefile.build:548: kernel] Fehler 2
make[1]: *** [/usr/src/linux-stable-rc/Makefile:2108: .] Fehler 2
make: *** [Makefile:248: __sub-make] Fehler 2
root@linus:/usr/src/linux-stable-rc#
Quoted 2 lines
The offending line seems to be part of
eb5b997dadc517(sched_ext: Skip tasks with staletask_rqinbypass_lb_cpu()) Adding Tejun and Andrea to CC.
The upstream commit (da2d81b4118a) was written on top of ff06f727a941 ("sched_ext: Move bypass_dsq into scx_sched_pcpu"), which renamed @rq to @donor_rq (among other things). That refactor is not in 7.0.y and it's not stable material.
I think The minimal fix is to rename donor_rq -> rq in the backported hunk, in 7.0.y the function still takes struct rq *rq directly, and that is the donor rq.
Greg, can you fold the following into the queued patch? Do you prefer a separate/updated patch?
Thanks,
-Andrea
kernel/sched/ext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/ext.c +2 -2
@@ -4013,10 +4013,10 @@ static u32 bypass_lb_cpu(struct scx_sched *sch, struct rq *rq,/* * If an earlier pass placed @p on @donor_dsq from a different * CPU and the donee hasn't consumed it yet, @p is still on the -* previous CPU and task_rq(@p) != @donor_rq. @p can't be moved +* previous CPU and task_rq(@p) != @rq. @p can't be moved * without its rq locked. Skip. */ -if (task_rq (p) != donor_rq) +if (task_rq (p) != rq)continue ; donee =cpumask_any_and_distribute (donee_mask, p->cpus_ptr);
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 7.0.7-rc1-g9fd19ccdb6f2 #1 SMP PREEMPT_DYNAMIC Wed May 13 07:11:13 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Greg Kroah-Hartman
maintainerRe: [PATCH 7.0 247/307] sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu()
In reply to Jiri SlabyQuoted 50 lines · Jiri Slaby
Quoted 29 lines · Greg Kroah-Hartman
7.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit
da2d81b4118a74e65d2335e221a38d665902a98cupstream.
bypass_lb_cpu()transfers tasks between per-CPU bypass DSQs without migrating them -task_cpu()only updates when the donee later consumes the task viamove_remote_task_to_local_dsq(). If the LB timer fires again before consumption and the new DSQ becomes a donor, @p is still on the previous CPU andtask_rq(@p)!=donor_rq. @p can't be moved without its own rq locked.Skip such tasks.
Fixes 95d1df610cdc ("sched_ext: Implement load balancer for bypass mode")Cc [email protected] # v6.19+Reported-by Chris Mason <[email protected]>Signed-off-by Tejun Heo <[email protected]>Reviewed-by Andrea Righi <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- kernel/sched/ext.c | 9 +++++++++ 1 file changed, 9 insertions(+)kernel/sched/ext.c resume: · line 4017
Quoted 10 lines
kernel/sched/ext.c +8
-0@@ -4008,6 +4008,15 @@ resume:if (cpumask_empty (donee_mask))break ; +/* +* If an earlier pass placed @p on @donor_dsq from a different +* CPU and the donee hasn't consumed it yet, @p is still on the +* previous CPU and task_rq(@p) != @donor_rq. @p can't be moved +* without its rq locked. Skip. +*/ +if (task_rq (p) != donor_rq) +continue ;As others pointed out already:
[ 75s] In file included from ../kernel/sched/build_policy.c:62: [ 75s] ../kernel/sched/ext.c: In function ‘bypass_lb_cpu’: [ 75s] ../kernel/sched/ext.c:4019:35: error: ‘donor_rq’ undeclared (first use in this function); did you mean ‘donee_rq’? [ 75s] 4019 | if (task_rq(p) != donor_rq) [ 75s] | ^~~~~~~~ [ 75s] | donee_rq
Quoted 6 lines
Donor and
donor_rqwere introduced in:
commitff06f727a9412b3c9f2f13f1441a5a0d2a31366bAuthor: Tejun Heo <[email protected]> Date: Fri Mar 6 07:58:03 2026 -1000
sched_ext: Movebypass_dsqintoscx_sched_pcpu
This is odd that it doesn't show up in my test builds/runs. I'll go drop this now, and push out a -rc2, thanks!
greg k-h
Greg Kroah-Hartman
maintainerQuoted 55 lines · Andrea Righi
Hello,
Quoted 24 lines · Peter Schneider
Hi Greg,
Am 12.05.2026 um 19:36 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 7.0.7 release. There are 307 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.
Trying to build 7.0.7-rc1, I get this build error.
In file included from
kernel/sched/build_policy.c:62:kernel/sched/ext.c: In function ‘bypass_lb_cpu’:kernel/sched/ext.c:4019:35: error: ‘donor_rq’ undeclared (first use in this function); did you mean ‘donee_rq’?4019 | if (task_rq(p) != donor_rq) | ^~~~~~~~ | donee_rq
kernel/sched/ext.c:4019:35: note: each undeclared identifier is reported only once for each function it appears in make[4]: *** [scripts/Makefile.build:289:kernel/sched/build_policy.o] Fehler 1
make[3]: *** [scripts/Makefile.build:548: kernel/sched] Fehler 2
make[2]: *** [scripts/Makefile.build:548: kernel] Fehler 2
make[1]: *** [/usr/src/linux-stable-rc/Makefile:2108: .] Fehler 2
make: *** [Makefile:248: __sub-make] Fehler 2
root@linus:/usr/src/linux-stable-rc#Quoted 2 lines
The offending line seems to be part of
eb5b997dadc517(sched_ext: Skip tasks with staletask_rqinbypass_lb_cpu()) Adding Tejun and Andrea to CC.The upstream commit (
da2d81b4118a) was written on top offf06f727a941("sched_ext: Movebypass_dsqintoscx_sched_pcpu"), which renamed @rq to @donor_rq (among other things). That refactor is not in 7.0.y and it's not stable material.I think The minimal fix is to rename
donor_rq-> rq in the backported hunk, in 7.0.y the function still takes struct rq *rq directly, and that is the donor rq.Greg, can you fold the following into the queued patch? Do you prefer a separate/updated patch?
Thanks,
(quoted diff) +0
-1-Andrea kernel/sched/ext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/sched/ext.c +0
-0@@ -4013,10 +4013,10 @@ static u32 bypass_lb_cpu(struct scx_sched *sch, struct rq *rq,/* * If an earlier pass placed @p on @donor_dsq from a different
kernel/sched/ext.c static u32 bypass_lb_cpu(struct scx_sched *sch, struct rq *rq, · line 4022
Quoted 10 lines
kernel/sched/ext.c +2
-2* CPU and the donee hasn't consumed it yet, @p is still on the -* previous CPU and task_rq(@p) != @donor_rq. @p can't be moved +* previous CPU and task_rq(@p) != @rq. @p can't be moved * without its rq locked. Skip. */ -if (task_rq (p) != donor_rq) +if (task_rq (p) != rq)continue ; donee =cpumask_any_and_distribute (donee_mask, p->cpus_ptr);
A whole new patch please.
thanks,
greg k-h
Re: [PATCH 7.0 247/307] sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu()
In reply to Greg Kroah-HartmanQuoted 5 lines · Greg Kroah-Hartman
This is odd that it doesn't show up in my test builds/runs. I'll go drop this now, and push out a -rc2, thanks!
greg k-h
One of my build machines was able to build 7.0.7_rc1 successfully. The only difference I see is that it does not have:CONFIG_SCHED_CLASS_EXT=y
--stephano
Greg Kroah-Hartman
maintainerRe: [PATCH 7.0 247/307] sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu()
Quoted 10 lines · Stephano Cetola
Quoted 5 lines · Greg Kroah-Hartman
This is odd that it doesn't show up in my test builds/runs. I'll go drop this now, and push out a -rc2, thanks!
greg k-h
One of my build machines was able to build 7.0.7_rc1 successfully. The only difference I see is that it does not have:
CONFIG_SCHED_CLASS_EXT=y
Which somehow doesn't get enabled with make allmodconfig :(
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.0.7 release. There are 307 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.
Re: [PATCH 7.0 247/307] sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu()
In reply to Greg Kroah-HartmanHi Greg,
Quoted 6 lines · Greg Kroah-Hartman
Quoted 5 lines · Stephano Cetola
Quoted 4 lines · Greg Kroah-Hartman
This is odd that it doesn't show up in my test builds/runs. I'll go drop this now, and push out a -rc2, thanks!
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
greg k-h
One of my build machines was able to build 7.0.7_rc1 successfully. The only difference I see is that it does not have:
CONFIG_SCHED_CLASS_EXT=yWhich somehow doesn't get enabled with
make allmodconfig:(
Do you have DEBUG_INFO_BTF disabled?
I think allmodconfig selects CONFIG_DEBUG_INFO_NONE=y => CONFIG_DEBUG_INFO_BTF=n => CONFIG_SCHED_CLASS_EXT=n, because:
config SCHED_CLASS_EXT
...
depends on BPF_SYSCALL && BPF_JIT && DEBUG_INFO_BTF
-Andrea
Greg Kroah-Hartman
maintainerRe: [PATCH 7.0 247/307] sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu()
Quoted 11 lines · Andrea Righi
Hi Greg,
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Stephano Cetola
Quoted 5 lines · Greg Kroah-Hartman
This is odd that it doesn't show up in my test builds/runs. I'll go drop this now, and push out a -rc2, thanks!
greg k-h
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
One of my build machines was able to build 7.0.7_rc1 successfully. The only difference I see is that it does not have:
CONFIG_SCHED_CLASS_EXT=yWhich somehow doesn't get enabled with
make allmodconfig:(Do you have
DEBUG_INFO_BTFdisabled?
Yup.
Quoted 6 lines
I think allmodconfig selects
CONFIG_DEBUG_INFO_NONE=y=>CONFIG_DEBUG_INFO_BTF=n=>CONFIG_SCHED_CLASS_EXT=n, because:config
SCHED_CLASS_EXT
...depends on BPF_SYSCALL && BPF_JIT && DEBUG_INFO_BTF
Probably, anyway, that's why my 'allmodconfig' builds did not catch this, and my "build a sane kernel that can boot" builds also did not.
thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 7.0.7 release. There are 307 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 Thu, 14 May 2026 17:38:03 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v7.x/stable-review/patch-7.0.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-7.0.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah