From: David Miller Date: Sun, 19 Jun 2016 06:52:25 +0000 (-0700) Subject: PCI: Fix unaligned accesses in VC code X-Git-Tag: v4.1.12-102.0.20170530_1700~31 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ef8b31f0ad328c483493bc96e7a8d3b70d9ed140;p=users%2Fjedix%2Flinux-maple.git PCI: Fix unaligned accesses in VC code The save/restore buffers for VC state is first composed of a 2-byte control register, then a bunch of 4-byte words. This causes unaligned accesses which trap on platform such as sparc. This is easy to fix by simply moving the buffer pointer forward by 4 bytes instead of 2 after dealing with the control register. The length adjustment needs to be changed likewise as well. Orabug: 25806778 Cherry-picked from b77b3610 PCI: Fix unaligned accesses in VC code Fixes: 5f8fc43217a0 ("PCI: Include pci/pcie/Kconfig directly from pci/Kconfig") Reported-by: Meelis Roos Reported-by: Anatoly Pugachev Signed-off-by: David S. Miller Signed-off-by: Bjorn Helgaas CC: stable@vger.kernel.org # v4.6+ Signed-off-by: Shannon Nelson Signed-off-by: Allen Pais --- diff --git a/drivers/pci/vc.c b/drivers/pci/vc.c index 7e1304d2e389c..3c7b46c7fc6de 100644 --- a/drivers/pci/vc.c +++ b/drivers/pci/vc.c @@ -222,9 +222,9 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos, else pci_write_config_word(dev, pos + PCI_VC_PORT_CTRL, *(u16 *)buf); - buf += 2; + buf += 4; } - len += 2; + len += 4; /* * If we have any Low Priority VCs and a VC Arbitration Table Offset