[PATCH net-next 1/1] net: stmmac: Add check for taprio basetime configuration

Lai Peter Jun Ann jun.ann.lai at intel.com
Thu Dec 8 01:03:15 PST 2022


From: Michael Sit Wei Hong <michael.wei.hong.sit at intel.com>

Adds a boundary check to prevent negative basetime input from user
while configuring taprio.

Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit at intel.com>
Signed-off-by: Lai Peter Jun Ann <jun.ann.lai at intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 773e415..2cfb18c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -926,6 +926,9 @@ static int tc_setup_taprio(struct stmmac_priv *priv,
 	int i, ret = 0;
 	u64 ctr;
 
+	if (qopt->base_time < 0)
+		return -ERANGE;
+
 	if (!priv->dma_cap.estsel)
 		return -EOPNOTSUPP;
 
-- 
1.9.1




More information about the linux-arm-kernel mailing list