Skip to content

Commit 152f508

Browse files
committed
net: stmmac: Fix zero-division error when disabling tc cbs
jira NONE_AUTOMATION cve CVE-2024-49977 Rebuild_History Non-Buildable kernel-5.14.0-570.12.1.el9_6 commit-author KhaiWenTan <[email protected]> commit 675faf5 The commit b8c4336 ("net: stmmac: No need to calculate speed divider when offload is disabled") allows the "port_transmit_rate_kbps" to be set to a value of 0, which is then passed to the "div_s64" function when tc-cbs is disabled. This leads to a zero-division error. When tc-cbs is disabled, the idleslope, sendslope, and credit values the credit values are not required to be configured. Therefore, adding a return statement after setting the txQ mode to DCB when tc-cbs is disabled would prevent a zero-division error. Fixes: b8c4336 ("net: stmmac: No need to calculate speed divider when offload is disabled") Cc: <[email protected]> Co-developed-by: Choong Yong Liang <[email protected]> Signed-off-by: Choong Yong Liang <[email protected]> Signed-off-by: KhaiWenTan <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]> (cherry picked from commit 675faf5) Signed-off-by: Jonathan Maple <[email protected]>
1 parent eaa1b94 commit 152f508

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
396396
return ret;
397397

398398
priv->plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB;
399+
return 0;
399400
}
400401

401402
/* Final adjustments for HW */

0 commit comments

Comments
 (0)