Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2166352iof; Tue, 7 Jun 2022 21:57:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzolMpYyuqPzXWP1lin/19CC+1GxMuQB2iWfN7SGaTVMJnTi7FiL1wFep8zSGOGkAnKBLFr X-Received: by 2002:a17:90a:f2ce:b0:1e8:3e55:bbfa with SMTP id gt14-20020a17090af2ce00b001e83e55bbfamr26517124pjb.204.1654664260873; Tue, 07 Jun 2022 21:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654664260; cv=none; d=google.com; s=arc-20160816; b=Bca2FGPn2zZXtJXu90dDl8vyi7pp3KL4sXpQ6lhFZRJg+oFhvYH0yJKNOlh3aA8Bca pa1QoVWIagxYIuoSpJtiCQkcDxwXQEYBZgS3YrZdcBrYbDKmua+b5CDDjqL+J4ufxDl+ 4rkwYFiPrzQ5AYZh9AMhXE7FjKy7v4rsPueVPiq76OHETOS5fnpQ5prUsOK1Vk0SjM/L awalJ7kUbA6mrMQNrqHwwukxYaf6EMkR02UF0hTKEXpPT/GhhrPTPT1Vvz+rHNSQE4vE I2XaG+B+1bEmD99BuaiRb8vZT9XbmmB/P22BTwz0GPI094MlUdwNJR2Z/55Bz20eNgC+ mUvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mH4JgELoz3akvJ2i7R8gjLqh273hsDAOsXNeiBSkbeo=; b=Vd98CIE59GuKR5KYe9uQJLAWAdXyDcD9SH4O7YbXNe95umsGUASYH+idvNUwGJMmPn DekqxyOg+kIcRpZ7VUpEbaSA9He9eDemUcWAFrw7XSjQNdSKUk57LSubcLIXExAPXg7+ GLLYrJa/0/DI7eMYEA3tRuLZr7rpH/75N/ASOG0FZLwguUWFgvdf/FLO3NXr7C2J4QbS hwR4klFMMhtWBESrNvlN2B7qSi2X6HgrLyosx4xXdD1MigCFlFJzkz0Oa4rh+Yr1jkcs Ql7XM/AnMiLWVGQFkNQfolwd5xagIslvA4kMch9Y7KicJ9IPbPHk0ZPN/2hINZU81qXN of3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="c8/ffwdJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t20-20020a635f14000000b003ab0604a0c9si26157412pgb.561.2022.06.07.21.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:57:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="c8/ffwdJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 609BF108AA5; Tue, 7 Jun 2022 21:26:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351057AbiFGSGn (ORCPT + 99 others); Tue, 7 Jun 2022 14:06:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349023AbiFGRqm (ORCPT ); Tue, 7 Jun 2022 13:46:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C4DF110AE8; Tue, 7 Jun 2022 10:36:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E323BB822B1; Tue, 7 Jun 2022 17:36:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 491ACC385A5; Tue, 7 Jun 2022 17:36:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623365; bh=UXh3PpBZOIoRc8pjCe0PxlCMx9HOwU9VH0FiE42sIEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c8/ffwdJdf5u+rAwokpvfiSszHs80FCDVL9glT5bFEB4Bd/DpxvnH6uXgvD71Hobh 9SQphz9cgsOG/xk4qKUhj6p4l1qnf2cylw01+Y0re/TGT+yR2XkLxVHmULatyEyP8V p3K1nUG1iJyErcoCyYXCH7RRNbqDabwQYnU14fRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Marciniszyn , Dennis Dalessandro , Jason Gunthorpe Subject: [PATCH 5.10 392/452] RDMA/hfi1: Fix potential integer multiplication overflow errors Date: Tue, 7 Jun 2022 19:04:09 +0200 Message-Id: <20220607164920.245402475@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Dennis Dalessandro commit f93e91a0372c922c20d5bee260b0f43b4b8a1bee upstream. When multiplying of different types, an overflow is possible even when storing the result in a larger type. This is because the conversion is done after the multiplication. So arithmetic overflow and thus in incorrect value is possible. Correct an instance of this in the inter packet delay calculation. Fix by ensuring one of the operands is u64 which will promote the other to u64 as well ensuring no overflow. Cc: stable@vger.kernel.org Fixes: 7724105686e7 ("IB/hfi1: add driver files") Link: https://lore.kernel.org/r/20220520183712.48973.29855.stgit@awfm-01.cornelisnetworks.com Reviewed-by: Mike Marciniszyn Signed-off-by: Dennis Dalessandro Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/hfi1/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/hw/hfi1/init.c +++ b/drivers/infiniband/hw/hfi1/init.c @@ -530,7 +530,7 @@ void set_link_ipg(struct hfi1_pportdata u16 shift, mult; u64 src; u32 current_egress_rate; /* Mbits /sec */ - u32 max_pkt_time; + u64 max_pkt_time; /* * max_pkt_time is the maximum packet egress time in units * of the fabric clock period 1/(805 MHz).