net: stmmac: Add check for taprio basetime configuration
authorMichael Sit Wei Hong <michael.wei.hong.sit@intel.com>
Thu, 8 Dec 2022 09:03:15 +0000 (17:03 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Dec 2022 09:35:27 +0000 (09:35 +0000)
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@intel.com>
Signed-off-by: Lai Peter Jun Ann <jun.ann.lai@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c

index 773e415..2cfb18c 100644 (file)
@@ -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;