Linux kernel -stable discussions
 help / color / mirror / Atom feed
* Re: Patch "PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support" has been added to the 5.10-stable tree
       [not found] <20240220012839.518852-1-sashal@kernel.org>
@ 2024-02-20  8:49 ` Niklas Cassel
  2024-02-23 15:41   ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Niklas Cassel @ 2024-02-20  8:49 UTC (permalink / raw)
  To: stable@vger.kernel.org
  Cc: stable-commits@vger.kernel.org, Jingoo Han, Gustavo Pimentel,
	Manivannan Sadhasivam, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas,
	Sasha Levin

[-- Attachment #1: Type: text/plain, Size: 1907 bytes --]

On Mon, Feb 19, 2024 at 08:28:39PM -0500, Sasha Levin wrote:
> This is a note to let you know that I've just added the patch titled
> 
>     PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support
> 
> to the 5.10-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:
>      pci-dwc-endpoint-fix-dw_pcie_ep_raise_msix_irq-align.patch
> and it can be found in the queue-5.10 subdirectory.
> 
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.

Hello stable maintainers,

I notice that upstream commit:
2217fffcd63f ("PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support")

has been backported (as it should) to:
5.10: https://marc.info/?l=linux-stable-commits&m=170839241818847&w=2 (only queued so far)
5.15: https://lore.kernel.org/stable/20240122235754.541847685@linuxfoundation.org/
6.1:  https://lore.kernel.org/stable/20240122235802.692374956@linuxfoundation.org/
6.6:  https://lore.kernel.org/stable/20240122235824.991665077@linuxfoundation.org/
6.7:  https://lore.kernel.org/stable/20240122235832.684822707@linuxfoundation.org/

Unfortunately, while this commit fixed a bug, it introduced another bug.


This "another bug" is fixed in upstream commit:
b5d1b4b46f85 ("PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()")

This fix has been backported to:
6.7: https://marc.info/?l=linux-stable-commits&m=170836979506847&w=2 (only queued so far)

But needs to be backported to 5.10, 5.15, 6.1, 6.6, 6.7.

It does not apply without conflicts, so I've attached two backported versions.
(There was a minor conflict with the headers.)

backport-all-but-5_10.patch - for 5.15, 6.1, 6.6, 6.7
backport-5_10.patch - for 5.10


Kind regards,
Niklas

[-- Attachment #2: backport-all-but-5_10.patch --]
[-- Type: text/plain, Size: 2139 bytes --]

From cbc98e30eb470a924d2fd59ae693d5480b3d263d Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter@linaro.org>
Date: Fri, 26 Jan 2024 11:40:37 +0300
Subject: [PATCH] PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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 <dan.carpenter@linaro.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
 drivers/pci/controller/dwc/pcie-designware-ep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
index 61a0f33c59cf..fcb1fdb22ffb 100644
--- 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 <kishon@ti.com>
  */
 
+#include <linux/align.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 
@@ -589,7 +590,7 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
 	}
 
 	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)
-- 
2.43.2


[-- Attachment #3: backport-5_10.patch --]
[-- Type: text/plain, Size: 2131 bytes --]

From 7ff5da5719c4d2ef67b89cdc9784bd8361b4b514 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter@linaro.org>
Date: Fri, 26 Jan 2024 11:40:37 +0300
Subject: [PATCH] PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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 <dan.carpenter@linaro.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
 drivers/pci/controller/dwc/pcie-designware-ep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
index e27bac623684..8b7ec0d9e90d 100644
--- 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 <kishon@ti.com>
  */
 
+#include <linux/align.h>
 #include <linux/of.h>
 
 #include "pcie-designware.h"
@@ -593,7 +594,7 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
 	}
 
 	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, ep->msi_mem_phys,  msg_addr,
 				  epc->mem->window.page_size);
 	if (ret)
-- 
2.43.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Patch "PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support" has been added to the 5.10-stable tree
  2024-02-20  8:49 ` Patch "PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support" has been added to the 5.10-stable tree Niklas Cassel
@ 2024-02-23 15:41   ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2024-02-23 15:41 UTC (permalink / raw)
  To: Niklas Cassel
  Cc: stable@vger.kernel.org, stable-commits@vger.kernel.org,
	Jingoo Han, Gustavo Pimentel, Manivannan Sadhasivam,
	Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
	Bjorn Helgaas, Sasha Levin

On Tue, Feb 20, 2024 at 08:49:35AM +0000, Niklas Cassel wrote:
> On Mon, Feb 19, 2024 at 08:28:39PM -0500, Sasha Levin wrote:
> > This is a note to let you know that I've just added the patch titled
> > 
> >     PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support
> > 
> > to the 5.10-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:
> >      pci-dwc-endpoint-fix-dw_pcie_ep_raise_msix_irq-align.patch
> > and it can be found in the queue-5.10 subdirectory.
> > 
> > If you, or anyone else, feels it should not be added to the stable tree,
> > please let <stable@vger.kernel.org> know about it.
> 
> Hello stable maintainers,
> 
> I notice that upstream commit:
> 2217fffcd63f ("PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support")
> 
> has been backported (as it should) to:
> 5.10: https://marc.info/?l=linux-stable-commits&m=170839241818847&w=2 (only queued so far)
> 5.15: https://lore.kernel.org/stable/20240122235754.541847685@linuxfoundation.org/
> 6.1:  https://lore.kernel.org/stable/20240122235802.692374956@linuxfoundation.org/
> 6.6:  https://lore.kernel.org/stable/20240122235824.991665077@linuxfoundation.org/
> 6.7:  https://lore.kernel.org/stable/20240122235832.684822707@linuxfoundation.org/
> 
> Unfortunately, while this commit fixed a bug, it introduced another bug.
> 
> 
> This "another bug" is fixed in upstream commit:
> b5d1b4b46f85 ("PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()")
> 
> This fix has been backported to:
> 6.7: https://marc.info/?l=linux-stable-commits&m=170836979506847&w=2 (only queued so far)
> 
> But needs to be backported to 5.10, 5.15, 6.1, 6.6, 6.7.
> 
> It does not apply without conflicts, so I've attached two backported versions.
> (There was a minor conflict with the headers.)
> 
> backport-all-but-5_10.patch - for 5.15, 6.1, 6.6, 6.7
> backport-5_10.patch - for 5.10

For some reason this was applied to 5.10.y, but not the other branches,
our fault!

The other one is now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-23 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240220012839.518852-1-sashal@kernel.org>
2024-02-20  8:49 ` Patch "PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support" has been added to the 5.10-stable tree Niklas Cassel
2024-02-23 15:41   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox