From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E4E3C282EC for ; Tue, 11 Mar 2025 11:04:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C84C340B62; Tue, 11 Mar 2025 11:04:28 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id xKyJiSV0zbhC; Tue, 11 Mar 2025 11:04:27 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BB2AB4090C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1741691067; bh=pphwc9HoAAG0yAZzRntnT4mIl10lrttBws2cUgZu6CY=; h=Date:From:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=5atRAHkyghpvCKS9k/7vJlDhcgdFS9T3W29Q7qzbytLGTEzC5rPPBsSb3m9/BYdEz cnVFGHkdZtCXVtcslQyBydBhYo4b9J3RHItPEFUbOoMHCa/4Sq9WLIBR9voYr8sNdZ aC0BvhKrRvYw7ywxmsiarD77SaDnemRlDrWZ4LDqkEyj7ClR+VDI+LuJivCZ+Gc463 wjjCVCAYzU3UjE7AYEm1dhZNE69svNzSW4xh8Rq2OFfY4Ce/5KxpOd7ag4svN9y7L/ M/aTLTa+T68qXnO472VSHL5kbYn9EPXQ6wX55z/e6IWI9GKzqClQmC7KYcp5gmBCba QbWqrrRIRFlrw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id BB2AB4090C; Tue, 11 Mar 2025 11:04:27 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists1.osuosl.org (Postfix) with ESMTP id 981421DA for ; Tue, 11 Mar 2025 11:04:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6193E40AF6 for ; Tue, 11 Mar 2025 11:04:26 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 8CbEqJZVD_De for ; Tue, 11 Mar 2025 11:04:25 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2604:1380:45d1:ec00::3; helo=nyc.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 54CE9400BD DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 54CE9400BD Received: from nyc.source.kernel.org (nyc.source.kernel.org [IPv6:2604:1380:45d1:ec00::3]) by smtp2.osuosl.org (Postfix) with ESMTPS id 54CE9400BD for ; Tue, 11 Mar 2025 11:04:25 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B4A5CA46B26; Tue, 11 Mar 2025 10:58:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9378BC4CEE9; Tue, 11 Mar 2025 11:04:21 +0000 (UTC) Date: Tue, 11 Mar 2025 12:04:18 +0100 From: Simon Horman To: Kyungwook Boo Cc: "Loktionov, Aleksandr" , Przemek Kitszel , Tony Nguyen , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Message-ID: <20250311110418.GK4159220@kernel.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741691063; bh=/JETuvOyKN6qqzVHVb4ofsOnUtJA9YuFu/oCz0Cz7N0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UmB6XRbU6pqC0YE+WAG8iDLMfJybbgWwoAV+5nDxZR4lLa42bDrLF0j8TQfeto/1t csjVFPcHzc5cEeOoGhgqYycQwzCvbFxmwYB/dmWiWxLKH1yI7c7YWG+cW5azDCwWvA 4p5UzoMr9sJnVfEFvLfk5pUidqzchXZWz1DsmeW5LQGnhifQsURQX7FVO7BPY/0oCL sMVVAORXKJrxFpA9iSYgby18xiPTasBFjvGCx6IR5OUc395ds+WOHmej9TqHJDpQIL Qc/onh1Phys5JPbtS1lUApmoCjRIsqpqvEXxyWI/B5GuQZyReweGsEP5VYo4deSZ09 4QhrjmJnNg/fg== X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=UmB6XRbU Subject: Re: [Intel-wired-lan] [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Tue, Mar 11, 2025 at 02:16:02PM +0900, Kyungwook Boo wrote: > When the device sends a specific input, an integer underflow can occur, leading > to MMIO write access to an invalid page. > > Prevent the integer underflow by changing the type of related variables. > > Signed-off-by: Kyungwook Boo > Link: https://lore.kernel.org/lkml/ffc91764-1142-4ba2-91b6-8c773f6f7095@gmail.com/T/ > --- > Changes in v2: > - Formatting properly > - Fix variable shadowing > - Link to v1: https://lore.kernel.org/netdev/55acc5dc-8d5a-45bc-a59c-9304071e4579@gmail.com/ > --- > drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c > index 370b4bddee44..b11c35e307ca 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_common.c > +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c > @@ -817,10 +817,11 @@ int i40e_pf_reset(struct i40e_hw *hw) > void i40e_clear_hw(struct i40e_hw *hw) > { > u32 num_queues, base_queue; > - u32 num_pf_int; > - u32 num_vf_int; > + s32 num_pf_int; > + s32 num_vf_int; > u32 num_vfs; > - u32 i, j; > + s32 i; > + u32 j; > u32 val; > u32 eol = 0x7ff; > > --- > base-commit: 4d872d51bc9d7b899c1f61534e3dbde72613f627 I see that this addresses the problem at the first link above. And I'd happy to see it accepted as-is. Reviewed-by: Simon Horman But, as an aside, wouldn't it be more appropriate to use generic types like int and unsigned int for most of the above variables? Perhaps this could be addressed by a follow-up. Or perhaps that would just be churn, IDK.