This is a note to let you know that I've just added the patch titled RDMA/hfi1: Fix potential integer multiplication overflow errors to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: rdma-hfi1-fix-potential-integer-multiplication-overflow-errors.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From f93e91a0372c922c20d5bee260b0f43b4b8a1bee Mon Sep 17 00:00:00 2001 From: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 20 May 2022 14:37:12 -0400 Subject: RDMA/hfi1: Fix potential integer multiplication overflow errors From: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx Fixes: 7724105686e7 ("IB/hfi1: add driver files") Link: https://lore.kernel.org/r/20220520183712.48973.29855.stgit@xxxxxxxxxxxxxxxxxxxxxxxxxxxx Reviewed-by: Mike Marciniszyn <mike.marciniszyn@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- 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 @@ -543,7 +543,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). Patches currently in stable-queue which might be from dennis.dalessandro@xxxxxxxxxxxxxxxxxxxx are queue-5.4/rdma-hfi1-fix-potential-integer-multiplication-overflow-errors.patch queue-5.4/rdma-hfi1-prevent-panic-when-sdma-is-disabled.patch queue-5.4/rdma-hfi1-prevent-use-of-lock-before-it-is-initializ.patch