From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94503145327; Tue, 27 Feb 2024 14:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709043171; cv=none; b=rxxtZdI9PALwIPxlWIgzJ+JDqky0cDZz9+zGkcBERVCStul6rxs9uWM6hu0W+nbaLRfEK6ivLY2sPGJ7mp1EayBgYYgoMZ/a9rmpAgTCvPvBkoVy7fKgOTJn/HZ63FaEC6cxEQgKMqirsWkLNsxlPM6QMLr6bPWKNdM8J/wWNms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709043171; c=relaxed/simple; bh=yoL5CXJlspvx6FyAbdBL3QXxbBySuHRpKdEnY0BAiSA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GHAG1jIrg+wA/vsxNaD9jHIOuTpL0kl1ArOSFISthhahkOCGmubxUjgL66iGtx37lblGZEEINUjMC8x1ZO0YNtU+Ag61VV9xImIWJxtoT11529touRhhiZ4F8dVWvadMls+vrnX2P5Z1rN4tfyXetp1r1aVdvE1vJIlw0GApHrY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bz3zohGe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="bz3zohGe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 238B4C433C7; Tue, 27 Feb 2024 14:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709043171; bh=yoL5CXJlspvx6FyAbdBL3QXxbBySuHRpKdEnY0BAiSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bz3zohGeSGEVAIvBPoZWcrcUUgqZn/yBt+e8AqGGBl1LMqnNTTcNJt8ivYDfdQ/// e2TdlqxCkUHk5Z0MNAKyCbdD1Z8SB9oBtfpzzVC3VoyCPsDpPjCR4NpnXJ/lQIRn9M XUfrvGJbNBmY2emcS6hs4vgksE9B7T/UtV5GWWq4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dan Carpenter , Bjorn Helgaas , Niklas Cassel , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Manivannan Sadhasivam Subject: [PATCH 6.1 006/195] PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq() Date: Tue, 27 Feb 2024 14:24:27 +0100 Message-ID: <20240227131610.610088823@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240227131610.391465389@linuxfoundation.org> References: <20240227131610.391465389@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter commit b5d1b4b46f856da1473c7ba9a5cdfcb55c9b2478 upstream. The "msg_addr" variable is u64. However, the "aligned_offset" is an unsigned int. This means that when the code does: msg_addr &= ~aligned_offset; it will unintentionally zero out the high 32 bits. Use ALIGN_DOWN() to do the alignment instead. Fixes: 2217fffcd63f ("PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support") Link: https://lore.kernel.org/r/af59c7ad-ab93-40f7-ad4a-7ac0b14d37f5@moroto.mountain Signed-off-by: Dan Carpenter Signed-off-by: Bjorn Helgaas Reviewed-by: Niklas Cassel Reviewed-by: Ilpo Järvinen Reviewed-by: Manivannan Sadhasivam Cc: Signed-off-by: Niklas Cassel Signed-off-by: Greg Kroah-Hartman --- drivers/pci/controller/dwc/pcie-designware-ep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -6,6 +6,7 @@ * Author: Kishon Vijay Abraham I */ +#include #include #include @@ -600,7 +601,7 @@ int dw_pcie_ep_raise_msix_irq(struct dw_ } aligned_offset = msg_addr & (epc->mem->window.page_size - 1); - msg_addr &= ~aligned_offset; + msg_addr = ALIGN_DOWN(msg_addr, epc->mem->window.page_size); ret = dw_pcie_ep_map_addr(epc, func_no, 0, ep->msi_mem_phys, msg_addr, epc->mem->window.page_size); if (ret)