From patchwork Tue Apr 5 15:56:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Neftin X-Patchwork-Id: 1613501 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=CKk0VBvv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KXsgw3nMDz9sBJ for ; Wed, 6 Apr 2022 01:56:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6E3EC415AC; Tue, 5 Apr 2022 15:56:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Cu2tXvy8WC2; Tue, 5 Apr 2022 15:56:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 4ADF5415BC; Tue, 5 Apr 2022 15:56:09 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id B27FF1BF842 for ; Tue, 5 Apr 2022 15:56:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 9435A813F1 for ; Tue, 5 Apr 2022 15:56:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=intel.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FobQxGktFnJS for ; Tue, 5 Apr 2022 15:56:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by smtp1.osuosl.org (Postfix) with ESMTPS id DB125813A9 for ; Tue, 5 Apr 2022 15:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649174166; x=1680710166; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9yvWZ8c/koFDLBQoenUWahky/eNHY7nMSOi2Om56oSk=; b=CKk0VBvv/8fxoMvIx3w0L9W0aLkb4BBeRXFG8+YB0LXdRufVtE3OOIlC bSlDE8eTDd2oSdm2DLb3sQ/zepHoQG+AZ9NxZNFPl2DshYyxFO1wMHD7C leVPiD7tFt7NK3DkSRrzDov/giAUaqk2Vat3krZVBKcngfMibq3JDRUaH CopM5DPM/mA8RjVyqRO8AhCmY4SeoznZFohPhqulhz2eteWpIb4izRlsC 4TLbKeipWegRiKXkhTzspWZgUQcxXEadeMvTv8meXhiAXT0uphrOF2T+Q JR1m7pLH6+j1lH0h3D8PG1IrKXGjJatXevl/pmFB/Dpgf69YzSlk3k+LP g==; X-IronPort-AV: E=McAfee;i="6200,9189,10308"; a="347227923" X-IronPort-AV: E=Sophos;i="5.90,236,1643702400"; d="scan'208";a="347227923" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2022 08:56:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,236,1643702400"; d="scan'208";a="657991537" Received: from ccdlinuxdev12.iil.intel.com ([143.185.162.56]) by orsmga004.jf.intel.com with ESMTP; 05 Apr 2022 08:56:04 -0700 From: Sasha Neftin To: intel-wired-lan@lists.osuosl.org Date: Tue, 5 Apr 2022 18:56:01 +0300 Message-Id: <20220405155601.1443799-1-sasha.neftin@intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH v2 1/1] e1000e: Fix possible overflow in LTR decoding X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: James Hutchinson , Dima Ruinskiy Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" When we decode the latency and the max_latency u16 value does not fill the required size and could lead to the wrong LTR representation. Replace the u16 type with the u32 type and allow corrected LTR representation. Fixes: 44a13a5d99c7 ("e1000e: Fix the max snoop/no-snoop latency for 10M") Reported-by: James Hutchinson Link: https://bugzilla.kernel.org/show_bug.cgi?id=215689 Suggested-by: Dima Ruinskiy Signed-off-by: Sasha Neftin Tested-by: Naama Meir Tested-by: James Hutchinson (I219-V (rev Tested-by: James Hutchinson --- v2: added link tag drivers/net/ethernet/intel/e1000e/ich8lan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index d60e2016d03c..e6c8e6d5234f 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c @@ -1009,8 +1009,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) { u32 reg = link << (E1000_LTRV_REQ_SHIFT + E1000_LTRV_NOSNOOP_SHIFT) | link << E1000_LTRV_REQ_SHIFT | E1000_LTRV_SEND; - u16 max_ltr_enc_d = 0; /* maximum LTR decoded by platform */ - u16 lat_enc_d = 0; /* latency decoded */ + u32 max_ltr_enc_d = 0; /* maximum LTR decoded by platform */ + u32 lat_enc_d = 0; /* latency decoded */ u16 lat_enc = 0; /* latency encoded */ if (link) {