Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp693150rwb; Thu, 8 Dec 2022 01:30:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf5uLJ62O75wGj6/nx0mZdnkjBnzlHtlJHDxgalS1Z83X/+00BS60RECvHqi9zz9VOlR/+0t X-Received: by 2002:a50:fa96:0:b0:46d:8ae8:961c with SMTP id w22-20020a50fa96000000b0046d8ae8961cmr2018663edr.359.1670491859385; Thu, 08 Dec 2022 01:30:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670491859; cv=none; d=google.com; s=arc-20160816; b=V+kxg1Z3B4xwDCOPRizFo2tnjmFAPLqGBYQoobRZc3EqY8re16fUxq3WaS3RjpMxsL U+PS5lzwUxQV92FjXJhW7Wgo/lAKS19dYWxKO1jgMU3/d+ijXHxhut1E7ON8UrbNmi14 IaQvF+4hq+yNiCcqBkUQDkuIql4r6oAfe76wNM18pzYPayYrDvUDu9XHCtaLw9nyami/ hNybCFkWTkOqpbM8q0DAhTnHY8dKPpgEQDC8KckWKCWGeCcBYGFcvjjQwVmFVvRBURqk hLR4vUikSpye8Jezuw9MnRF2pvYax3zCHCHx/LS+sKBwRKzPDpmKXM6vVIhZJ/1CRDye /HFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=KQy1EMUsf7O/PBvL9XkeKqxjyKrkk+kdPtpVpm5vK64=; b=KG19v0tdoZFZDdJE2Nz7GACmcGzaQcr+cHEJ5XAlkhuM4AqKNU+StvqQheowdmuRpw 18uQYyvwU9w+Irz/68IYPmsK+hUJpBGSr1CaaE6W+2H3E/CQlzVobX+6YtgzXIaM52LM xtm1yHMr1eq9enoU433HxCJ4+GhLEc2fSneasDY50CQ5MUpWm2kMT4XVoww6ApNv0fVB W2e79WCCtnLPzN4MhmlE/Pl/i3DKXiogMXWZnF0W1E/vrmhV7FB+uZWKj2dGmUW1d1v8 42Br19s863TN+c6FITaCGrZ+SP31LWSkhXa4AFnFFD+V3fRxtfpaH/NIISNGl/0JL/mq xFdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dK7sIzIn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s15-20020a056402014f00b0046b953601besi5429499edu.29.2022.12.08.01.30.41; Thu, 08 Dec 2022 01:30:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dK7sIzIn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230224AbiLHJGK (ORCPT + 72 others); Thu, 8 Dec 2022 04:06:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbiLHJFx (ORCPT ); Thu, 8 Dec 2022 04:05:53 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDF8A73F62; Thu, 8 Dec 2022 01:04:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670490273; x=1702026273; h=from:to:cc:subject:date:message-id; bh=UA+smJjZZYbFnblJ4yJ0P96Z25fhqeBCuoWHkuOYe74=; b=dK7sIzIncfCkR1apA+JyjDmSSCxolKWOYAHhM/KwWFZbj4wQ8I9gsgVE kzLj2pc9WQqNGWXEoh+C1AEpaewa1Zl+DlJk7PRhCqQkpbzTVoATdOgbl d6u4PXnvDoCK9ZvZAccQDbKN2jmdHko9HFhQcfpqsKQUcwjcxk/GK87Wm Ba3fOinjO+l6/w9VcPKP+f4MWcdof7k1mW9mQlixgeF6TWu+1BRQqr4Ij UaDtmk8ZGQhJNsHeq5vKCaqm6RqJwS3vkPJmRZrqEcgIfsHKci2a8NzgK 75SXPndmx+GsXKKt2HceLenbYtWYLENWW5RXmscbxxn1BqQZ6YQSzI1Ek w==; X-IronPort-AV: E=McAfee;i="6500,9779,10554"; a="381413937" X-IronPort-AV: E=Sophos;i="5.96,227,1665471600"; d="scan'208";a="381413937" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2022 01:03:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10554"; a="975786174" X-IronPort-AV: E=Sophos;i="5.96,227,1665471600"; d="scan'208";a="975786174" Received: from ssid-ilbpg3.png.intel.com ([10.88.227.111]) by fmsmga005.fm.intel.com with ESMTP; 08 Dec 2022 01:03:16 -0800 From: Lai Peter Jun Ann To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Michael Sit Wei Hong , Lai Peter Jun Ann Subject: [PATCH net-next 1/1] net: stmmac: Add check for taprio basetime configuration Date: Thu, 8 Dec 2022 17:03:15 +0800 Message-Id: <1670490195-19367-1-git-send-email-jun.ann.lai@intel.com> X-Mailer: git-send-email 1.9.1 X-Spam-Status: No, score=-1.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Sit Wei Hong Adds a boundary check to prevent negative basetime input from user while configuring taprio. Signed-off-by: Michael Sit Wei Hong Signed-off-by: Lai Peter Jun Ann --- 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