Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp439125iog; Mon, 13 Jun 2022 06:03:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+7H/F2D9aYfEW9uYY3/aU6huD9P0H+GOYh8O0N/T50tvw6y+SvSKXocCg1NgqJK1ip3eB X-Received: by 2002:aa7:d456:0:b0:42d:d7d9:34c1 with SMTP id q22-20020aa7d456000000b0042dd7d934c1mr65619374edr.21.1655125392687; Mon, 13 Jun 2022 06:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125392; cv=none; d=google.com; s=arc-20160816; b=DgRNWZeVQsZT0SgQFB++d3rNli3Q1/+Bi7qWW4BW/TS7ibfTo2eY42l8AtlQQV3tqP /MgXt5L37VBoZfli7cHr1WQCh7DPyvseojrA6wEpqpBAkLd5Ic65m+Jig9+x+zwPhJdu bqD4+Cx5wrgH4OBHCVuFVZb4p1R7s28xcD5a1QKrxSfDVo54SDBT+7Gd9WJV9uObMTBE L3ueVzORhNIIPn6kGt8WWItIpQ5EHjXuJqV5VuvxTPmGE7j1pLnWA9XRF4wetxqjtQ9w ZbFF98dgDKV1Lus62wrG5fEXvaQxeEYx8kIoAqeITcIMdCZf7Z4O2ll1sEHvAMigV8u9 FX0w== 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=h3rA7b4mmOwq7FFL8JLX7BP7C9veC9eb42/ocCcPyM8=; b=VMmQZvEEh2u97M8SmKOoExCBi/yfyweHOmHIqrs9oTtyPsjxS/15lgbd2lVjrIO/9r gVEqDVbsxwi5HKsA+umSlKcvk7t3YHXy0+Mho2EB66H8JMOwZzPEoLnajBVEfpIILZ+8 YYYW/BUeWTrFZalizcC99sJkcfUgoVAyOZs1Qf9IqtfeF4eViICRPVBdC8kGX4ktukjR M240ZNGATx6sEgbgMsesaPjKKgsasX5Q08a0BG4J2I1Ha2YMYTcPHxhBt+GoxBmzuhY4 KqqMd0kpGpx/qvcwxaNDZsIl4s7Uixlvv98utR/Th02qw6tfJhHDNrp2MC8CDHDH9Osm VVvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HQyichGE; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 27-20020a170906001b00b00718bf77195dsi2830573eja.489.2022.06.13.06.02.46; Mon, 13 Jun 2022 06:03:12 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=HQyichGE; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241440AbiFMKZF (ORCPT + 99 others); Mon, 13 Jun 2022 06:25:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242924AbiFMKXD (ORCPT ); Mon, 13 Jun 2022 06:23:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6E6520191; Mon, 13 Jun 2022 03:17:56 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 636DE60765; Mon, 13 Jun 2022 10:17:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EC76C34114; Mon, 13 Jun 2022 10:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115475; bh=v08BkH7BAVYVN+ff+HIyV6Hzd31WVjJQmaTDV3f3l+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HQyichGEo5y2q6wpENyne5EY1+qQyDNHVjX2OuaqnlgBK+d/ilM7UC4xln21WBaVe cYkOZ6AfzZMGsbNRTPaHrwID05D2d8B5VobFTpTpch+BySIA2KVO7vf7Qk2/s+/ZkA ghTHFinRaxCQg5dL94YHJWmqnUHJO2DndKPtnGm0= 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 4.9 090/167] RDMA/hfi1: Fix potential integer multiplication overflow errors Date: Mon, 13 Jun 2022 12:09:24 +0200 Message-Id: <20220613094902.010851477@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094840.720778945@linuxfoundation.org> References: <20220613094840.720778945@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=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 @@ -371,7 +371,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).