* [PATCH net v3 0/2] net: stmmac: misc fixes
@ 2025-09-16 9:25 Konrad Leszczynski
2025-09-16 9:25 ` [PATCH net v3 1/2] net: stmmac: replace memcpy with ethtool_puts in ethtool Konrad Leszczynski
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Konrad Leszczynski @ 2025-09-16 9:25 UTC (permalink / raw)
To: davem, andrew+netdev, edumazet, kuba, pabeni
Cc: netdev, linux-kernel, cezary.rojewski, sebastian.basierski,
Konrad Leszczynski
This series adds two fixes addressing KASAN panic on ethtool usage and
flow stop on TC block setup when interface down.
Patchset has been created as a result of discussion at [1].
v2 can be found at [2].
[1] https://lore.kernel.org/netdev/20250826113247.3481273-1-konrad.leszczynski@intel.com/
[2] https://lore.kernel.org/netdev/20250828100237.4076570-1-konrad.leszczynski@intel.com/
v2 -> v3:
- replace strcpy with ethtool_puts per suggestion
- removed extension patch for printing enhanced descriptors
v1 -> v2:
- add missing Fixes lines
- add missing SoB lines
- removed all non-fix patches. These will be sent in separate series
Karol Jurczenia (1):
net: stmmac: check if interface is running before TC block setup
Konrad Leszczynski (1):
net: stmmac: replace memcpy with ethtool_puts in ethtool
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net v3 1/2] net: stmmac: replace memcpy with ethtool_puts in ethtool
2025-09-16 9:25 [PATCH net v3 0/2] net: stmmac: misc fixes Konrad Leszczynski
@ 2025-09-16 9:25 ` Konrad Leszczynski
2025-09-16 16:26 ` Simon Horman
2025-09-16 9:25 ` [PATCH net v3 2/2] net: stmmac: check if interface is running before TC block setup Konrad Leszczynski
2025-09-16 23:27 ` [PATCH net v3 0/2] net: stmmac: misc fixes Jakub Kicinski
2 siblings, 1 reply; 5+ messages in thread
From: Konrad Leszczynski @ 2025-09-16 9:25 UTC (permalink / raw)
To: davem, andrew+netdev, edumazet, kuba, pabeni
Cc: netdev, linux-kernel, cezary.rojewski, sebastian.basierski,
Konrad Leszczynski
Fix kernel exception by replacing memcpy with ethtool_puts when used with
safety feature strings in ethtool logic.
[ +0.000023] BUG: KASAN: global-out-of-bounds in stmmac_get_strings+0x17d/0x520 [stmmac]
[ +0.000115] Read of size 32 at addr ffffffffc0cfab20 by task ethtool/2571
[ +0.000005] Call Trace:
[ +0.000004] <TASK>
[ +0.000003] dump_stack_lvl+0x6c/0x90
[ +0.000016] print_report+0xce/0x610
[ +0.000011] ? stmmac_get_strings+0x17d/0x520 [stmmac]
[ +0.000108] ? kasan_addr_to_slab+0xd/0xa0
[ +0.000008] ? stmmac_get_strings+0x17d/0x520 [stmmac]
[ +0.000101] kasan_report+0xd4/0x110
[ +0.000010] ? stmmac_get_strings+0x17d/0x520 [stmmac]
[ +0.000102] kasan_check_range+0x3a/0x1c0
[ +0.000010] __asan_memcpy+0x24/0x70
[ +0.000008] stmmac_get_strings+0x17d/0x520 [stmmac]
Reviewed-by: Sebastian Basierski <sebastian.basierski@intel.com>
Signed-off-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 77758a7299b4..d5a2b7e9b2a9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -752,7 +752,7 @@ static void stmmac_get_strings(struct net_device *dev, u32 stringset, u8 *data)
if (!stmmac_safety_feat_dump(priv,
&priv->sstats, i,
NULL, &desc)) {
- memcpy(p, desc, ETH_GSTRING_LEN);
+ ethtool_puts(&p, desc);
p += ETH_GSTRING_LEN;
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net v3 2/2] net: stmmac: check if interface is running before TC block setup
2025-09-16 9:25 [PATCH net v3 0/2] net: stmmac: misc fixes Konrad Leszczynski
2025-09-16 9:25 ` [PATCH net v3 1/2] net: stmmac: replace memcpy with ethtool_puts in ethtool Konrad Leszczynski
@ 2025-09-16 9:25 ` Konrad Leszczynski
2025-09-16 23:27 ` [PATCH net v3 0/2] net: stmmac: misc fixes Jakub Kicinski
2 siblings, 0 replies; 5+ messages in thread
From: Konrad Leszczynski @ 2025-09-16 9:25 UTC (permalink / raw)
To: davem, andrew+netdev, edumazet, kuba, pabeni
Cc: netdev, linux-kernel, cezary.rojewski, sebastian.basierski,
Karol Jurczenia, Konrad Leszczynski
From: Karol Jurczenia <karol.jurczenia@intel.com>
If the interface is down before setting a TC block, the queues are already
disabled and setup cannot proceed.
Reviewed-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Reviewed-by: Sebastian Basierski <sebastian.basierski@intel.com>
Signed-off-by: Karol Jurczenia <karol.jurczenia@intel.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 7b16d1207b80..133ffdc91153 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6247,6 +6247,9 @@ static int stmmac_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
struct stmmac_priv *priv = cb_priv;
int ret = -EOPNOTSUPP;
+ if (!netif_running(priv->dev))
+ return -EINVAL;
+
if (!tc_cls_can_offload_and_chain0(priv->dev, type_data))
return ret;
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net v3 1/2] net: stmmac: replace memcpy with ethtool_puts in ethtool
2025-09-16 9:25 ` [PATCH net v3 1/2] net: stmmac: replace memcpy with ethtool_puts in ethtool Konrad Leszczynski
@ 2025-09-16 16:26 ` Simon Horman
0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2025-09-16 16:26 UTC (permalink / raw)
To: Konrad Leszczynski
Cc: davem, andrew+netdev, edumazet, kuba, pabeni, netdev,
linux-kernel, cezary.rojewski, sebastian.basierski
On Tue, Sep 16, 2025 at 11:25:06AM +0200, Konrad Leszczynski wrote:
> Fix kernel exception by replacing memcpy with ethtool_puts when used with
> safety feature strings in ethtool logic.
>
> [ +0.000023] BUG: KASAN: global-out-of-bounds in stmmac_get_strings+0x17d/0x520 [stmmac]
> [ +0.000115] Read of size 32 at addr ffffffffc0cfab20 by task ethtool/2571
>
> [ +0.000005] Call Trace:
> [ +0.000004] <TASK>
> [ +0.000003] dump_stack_lvl+0x6c/0x90
> [ +0.000016] print_report+0xce/0x610
> [ +0.000011] ? stmmac_get_strings+0x17d/0x520 [stmmac]
> [ +0.000108] ? kasan_addr_to_slab+0xd/0xa0
> [ +0.000008] ? stmmac_get_strings+0x17d/0x520 [stmmac]
> [ +0.000101] kasan_report+0xd4/0x110
> [ +0.000010] ? stmmac_get_strings+0x17d/0x520 [stmmac]
> [ +0.000102] kasan_check_range+0x3a/0x1c0
> [ +0.000010] __asan_memcpy+0x24/0x70
> [ +0.000008] stmmac_get_strings+0x17d/0x520 [stmmac]
I think it would be worth adding some commentary around
why memcpy results in this problem in this case.
>
> Reviewed-by: Sebastian Basierski <sebastian.basierski@intel.com>
> Signed-off-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> index 77758a7299b4..d5a2b7e9b2a9 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> @@ -752,7 +752,7 @@ static void stmmac_get_strings(struct net_device *dev, u32 stringset, u8 *data)
> if (!stmmac_safety_feat_dump(priv,
> &priv->sstats, i,
> NULL, &desc)) {
> - memcpy(p, desc, ETH_GSTRING_LEN);
> + ethtool_puts(&p, desc);
> p += ETH_GSTRING_LEN;
ethtool_puts() increments p, so I think the line above should be removed.
> }
> }
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v3 0/2] net: stmmac: misc fixes
2025-09-16 9:25 [PATCH net v3 0/2] net: stmmac: misc fixes Konrad Leszczynski
2025-09-16 9:25 ` [PATCH net v3 1/2] net: stmmac: replace memcpy with ethtool_puts in ethtool Konrad Leszczynski
2025-09-16 9:25 ` [PATCH net v3 2/2] net: stmmac: check if interface is running before TC block setup Konrad Leszczynski
@ 2025-09-16 23:27 ` Jakub Kicinski
2 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2025-09-16 23:27 UTC (permalink / raw)
To: Konrad Leszczynski
Cc: davem, andrew+netdev, edumazet, pabeni, netdev, linux-kernel,
cezary.rojewski, sebastian.basierski, Przemek Kitszel
On Tue, 16 Sep 2025 11:25:05 +0200 Konrad Leszczynski wrote:
> This series adds two fixes addressing KASAN panic on ethtool usage and
> flow stop on TC block setup when interface down.
>
> Patchset has been created as a result of discussion at [1].
Please make sure you wait 24h between repostings, per:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html
--
pv-bot: 24h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-16 23:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16 9:25 [PATCH net v3 0/2] net: stmmac: misc fixes Konrad Leszczynski
2025-09-16 9:25 ` [PATCH net v3 1/2] net: stmmac: replace memcpy with ethtool_puts in ethtool Konrad Leszczynski
2025-09-16 16:26 ` Simon Horman
2025-09-16 9:25 ` [PATCH net v3 2/2] net: stmmac: check if interface is running before TC block setup Konrad Leszczynski
2025-09-16 23:27 ` [PATCH net v3 0/2] net: stmmac: misc fixes Jakub Kicinski
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).