net: mana: hardening: Reject zero max_num_queues from MANA_QUERY_VPORT_CONFIG
PATCH v2 1/1 net: mana: hardening: Reject zero max_num_queues from MANA_QUERY_VPORT_CONFIG
As a part of MANA hardening for CVM, validate that max_num_sq and max_num_rq returned by MANA_QUERY_VPORT_CONFIG are not zero. These values flow into apc->num_queues, which is used as an allocation count and loop bound. A zero value would result in zero-size allocations and incorrect driver behavior.
Return -EPROTO if either value is zero.
---
Changes in v2:
* Rebase to latest main.
--- drivers/net/ethernet/microsoft/mana/mana_en.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/microsoft/mana/mana_en.c +6 -0
@@ -1262,6 +1262,12 @@ static int mana_query_vport_cfg(struct mana_port_context *apc, u32 vport_index, *max_sq = resp.max_num_sq; *max_rq = resp.max_num_rq; + +if (*max_sq ==0 || *max_rq ==0 ) { +netdev_err (apc->ndev,"Invalid max queues from vPort config\n" ); +return -EPROTO ; + } +if (resp.num_indirection_ent >0 && resp.num_indirection_ent <=MANA_INDIRECT_TABLE_MAX_SIZE &&is_power_of_2 (resp.num_indirection_ent)) {
Signature · 1 line
2.34.1
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Thu, 30 Apr 2026 01:56:31 -0700 you wrote:
As a part of MANA hardening for CVM, validate that
max_num_sqandmax_num_rqreturned byMANA_QUERY_VPORT_CONFIGare not zero. These values flow intoapc->num_queues, which is used as an allocation count and loop bound. A zero value would result in zero-size allocations and incorrect driver behavior.Return
-EPROTOif either value is zero.[...]
Here is the summary with links:
- [net-next,v2] net: mana: hardening: Reject zero max_num_queues from MANA_QUERY_VPORT_CONFIG
https://git.kernel.org/netdev/net-next/c/93ca1575dd1f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html