* [PATCH net v2] ethtool: cmis_cdb: use correct rpl size in ethtool_cmis_module_poll()
@ 2025-04-09 17:33 Michael Chan
2025-04-12 2:01 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Michael Chan @ 2025-04-09 17:33 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, kuba, pabeni, andrew, horms, danieller,
damodharam.ammepalli, andrew.gospodarek, idosch
From: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
rpl is passed as a pointer to ethtool_cmis_module_poll(), so the correct
size of rpl is sizeof(*rpl) which should be just 1 byte. Using the
pointer size instead can cause stack corruption:
Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ethtool_cmis_wait_for_cond+0xf4/0x100
CPU: 72 UID: 0 PID: 4440 Comm: kworker/72:2 Kdump: loaded Tainted: G OE 6.11.0 #24
Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
Hardware name: Dell Inc. PowerEdge R760/04GWWM, BIOS 1.6.6 09/20/2023
Workqueue: events module_flash_fw_work
Call Trace:
<TASK>
panic+0x339/0x360
? ethtool_cmis_wait_for_cond+0xf4/0x100
? __pfx_status_success+0x10/0x10
? __pfx_status_fail+0x10/0x10
__stack_chk_fail+0x10/0x10
ethtool_cmis_wait_for_cond+0xf4/0x100
ethtool_cmis_cdb_execute_cmd+0x1fc/0x330
? __pfx_status_fail+0x10/0x10
cmis_cdb_module_features_get+0x6d/0xd0
ethtool_cmis_cdb_init+0x8a/0xd0
ethtool_cmis_fw_update+0x46/0x1d0
module_flash_fw_work+0x17/0xa0
process_one_work+0x179/0x390
worker_thread+0x239/0x340
? __pfx_worker_thread+0x10/0x10
kthread+0xcc/0x100
? __pfx_kthread+0x10/0x10
ret_from_fork+0x2d/0x50
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1a/0x30
</TASK>
Fixes: a39c84d79625 ("ethtool: cmis_cdb: Add a layer for supporting CDB commands")
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
v2:
Dropped patch #2
Fixed the Fixes tag
v1: https://lore.kernel.org/netdev/20250402183123.321036-1-michael.chan@broadcom.com/
---
net/ethtool/cmis_cdb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ethtool/cmis_cdb.c b/net/ethtool/cmis_cdb.c
index d159dc121bde..dba3aa909a95 100644
--- a/net/ethtool/cmis_cdb.c
+++ b/net/ethtool/cmis_cdb.c
@@ -363,7 +363,7 @@ ethtool_cmis_module_poll(struct net_device *dev,
struct netlink_ext_ack extack = {};
int err;
- ethtool_cmis_page_init(&page_data, 0, offset, sizeof(rpl));
+ ethtool_cmis_page_init(&page_data, 0, offset, sizeof(*rpl));
page_data.data = (u8 *)rpl;
err = ops->get_module_eeprom_by_page(dev, &page_data, &extack);
--
2.30.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net v2] ethtool: cmis_cdb: use correct rpl size in ethtool_cmis_module_poll()
2025-04-09 17:33 [PATCH net v2] ethtool: cmis_cdb: use correct rpl size in ethtool_cmis_module_poll() Michael Chan
@ 2025-04-12 2:01 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-12 2:01 UTC (permalink / raw)
To: Michael Chan
Cc: davem, netdev, edumazet, kuba, pabeni, andrew, horms, danieller,
damodharam.ammepalli, andrew.gospodarek, idosch
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 9 Apr 2025 10:33:12 -0700 you wrote:
> From: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com>
>
> rpl is passed as a pointer to ethtool_cmis_module_poll(), so the correct
> size of rpl is sizeof(*rpl) which should be just 1 byte. Using the
> pointer size instead can cause stack corruption:
>
> Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ethtool_cmis_wait_for_cond+0xf4/0x100
> CPU: 72 UID: 0 PID: 4440 Comm: kworker/72:2 Kdump: loaded Tainted: G OE 6.11.0 #24
> Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
> Hardware name: Dell Inc. PowerEdge R760/04GWWM, BIOS 1.6.6 09/20/2023
> Workqueue: events module_flash_fw_work
> Call Trace:
> <TASK>
> panic+0x339/0x360
> ? ethtool_cmis_wait_for_cond+0xf4/0x100
> ? __pfx_status_success+0x10/0x10
> ? __pfx_status_fail+0x10/0x10
> __stack_chk_fail+0x10/0x10
> ethtool_cmis_wait_for_cond+0xf4/0x100
> ethtool_cmis_cdb_execute_cmd+0x1fc/0x330
> ? __pfx_status_fail+0x10/0x10
> cmis_cdb_module_features_get+0x6d/0xd0
> ethtool_cmis_cdb_init+0x8a/0xd0
> ethtool_cmis_fw_update+0x46/0x1d0
> module_flash_fw_work+0x17/0xa0
> process_one_work+0x179/0x390
> worker_thread+0x239/0x340
> ? __pfx_worker_thread+0x10/0x10
> kthread+0xcc/0x100
> ? __pfx_kthread+0x10/0x10
> ret_from_fork+0x2d/0x50
> ? __pfx_kthread+0x10/0x10
> ret_from_fork_asm+0x1a/0x30
> </TASK>
>
> [...]
Here is the summary with links:
- [net,v2] ethtool: cmis_cdb: use correct rpl size in ethtool_cmis_module_poll()
https://git.kernel.org/netdev/net/c/f3fdd4fba16c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-12 2:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-09 17:33 [PATCH net v2] ethtool: cmis_cdb: use correct rpl size in ethtool_cmis_module_poll() Michael Chan
2025-04-12 2:01 ` patchwork-bot+netdevbpf
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).