Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2266806iof; Wed, 8 Jun 2022 00:55:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD7l8Nyd0/4JBL2QOuMCpSvEPh0TjLxJot86LyASWZHc015CFtayiC9aRhxwyMe0VxTXe3 X-Received: by 2002:a17:902:cf05:b0:156:8445:ce0f with SMTP id i5-20020a170902cf0500b001568445ce0fmr33019466plg.99.1654674929986; Wed, 08 Jun 2022 00:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654674929; cv=none; d=google.com; s=arc-20160816; b=uKTRynmtQNItTwT2A4j2bigzJ5vW8TSTurfgyUsWSlKODLSvlBrRLDl6qfv2ZacJpx wONAjHPvIQbvBdyyfi0gPIxkzSrjfqhWW0aEkJZ5KrJBmhVoJxhxafCHzaTV1UtYtbOQ Atd0nVSyRfAFeAKYm4/At8t63NNJXwH4SJCuj29Nthls7MIS3uORGjC+7Skm2s5SHgO/ XOtY15DnVW0d4MZrl6zcWiIeWTkqewx9zZanf1zLgr3oLnPD0DlhLi/aclDzNsPCx8Hk WmvChg0KoMWlLCT4H4RHigIJU5DbXpd5PLQ5n9vHN2FEg0j/U8YmOrPZbDqt5Hhh64XZ IrPw== 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=VKcHJTfzw/6DkKNa2g/tQ4lBLYtzB5C9+nuev59fqIY=; b=eU1cCPdWLnjOIVTlLUX8eKCZ1eK3aRK3fPtCMeFk3RMnRMuHFPySx9BbjqJ9UKSQRL 3W2CAQ6j4Pm/B8s8CGfWpjE6w7EXqTK/oPoTOLyvOIFqkAHoBrYC/Wv9QeLUVt6jRbM5 8THch7mX/53/822Ffx23y4auLbKc4jqfJRQc+CKO721vI3uMgb1WTGMD+V9CpnvB7JI9 wkFKdqxc+49Ta+bnze1K31RCsVAgqAlU+nZy0aX4bAfZsxYYIF2M1LXnpCfuTL3Ie/i1 U8lM66tkslvsUjJOsWVjNM5D8kAaSjoOvWbbSUm1lRKxzCffdZHMpZ7BSLJg38Djz9yU V35g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IEPoVUii; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id v17-20020a056a00149100b0051b51d8211fsi17429685pfu.91.2022.06.08.00.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 00:55:29 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IEPoVUii; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3A85C1DC850; Wed, 8 Jun 2022 00:24:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442288AbiFHAyQ (ORCPT + 99 others); Tue, 7 Jun 2022 20:54:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383441AbiFGWa6 (ORCPT ); Tue, 7 Jun 2022 18:30:58 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7E28275596; Tue, 7 Jun 2022 12:23:59 -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 sin.source.kernel.org (Postfix) with ESMTPS id 718A7CE2476; Tue, 7 Jun 2022 19:23:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ADC8C385A2; Tue, 7 Jun 2022 19:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629835; bh=h3I5A+wDlDqLSRwTv8fsj9hr+2X2VVhVi4iPFBVDOFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IEPoVUiiWOe7kJumph+Bw+L+HHVeWFm7ApLJgnhtNtEeoQVRUVanK7Tp3nMuWn7Nh Ai9Jh5QfPb0fn0BdtOFpac5QwQxwq8QFCPsw67ux475ih5cumxeH1UsnCChaWDGoEs TDyyRMhFRM9MUsLViX9bspV9KucT49qwWaKcXRKM= 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.18 807/879] RDMA/hfi1: Fix potential integer multiplication overflow errors Date: Tue, 7 Jun 2022 19:05:25 +0200 Message-Id: <20220607165026.282007587@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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 @@ -489,7 +489,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).