]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
igc: Add checking for basetime less than zero
authorMuhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
Fri, 9 Dec 2022 04:15:19 +0000 (12:15 +0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 15 Dec 2022 21:19:39 +0000 (13:19 -0800)
Using the tc qdisc command, the user can set basetime to any value.
Checking should be done on the driver's side to prevent registering
basetime values that are less than zero.

Fixes: ec50a9d437f0 ("igc: Add support for taprio offloading")
Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/igc/igc_main.c

index c67a8e8ea972b115906ec0f643431a20a5e86a44..6ed12329ae80e11f202c8f3e53729f67759ad145 100644 (file)
@@ -6047,6 +6047,9 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,
        if (!qopt->enable)
                return igc_tsn_clear_schedule(adapter);
 
+       if (qopt->base_time < 0)
+               return -ERANGE;
+
        if (adapter->base_time)
                return -EALREADY;