diff options
author | David Miller <davem@davemloft.net> | 2016-06-19 08:52:25 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-06-20 20:24:20 +0200 |
commit | ef0dab4aae14e25efddf1577736f8450132800c5 (patch) | |
tree | 6e35085e725dd7ba3a40d0fad903d4e55c1fd828 /drivers/pci/vc.c | |
parent | Linux 4.7-rc2 (diff) | |
download | linux-ef0dab4aae14e25efddf1577736f8450132800c5.tar.xz linux-ef0dab4aae14e25efddf1577736f8450132800c5.zip |
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.
Fixes: 5f8fc43217a0 ("PCI: Include pci/pcie/Kconfig directly from pci/Kconfig")
Reported-by: Meelis Roos <mroos@linux.ee>
Reported-by: Anatoly Pugachev <matorola@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: stable@vger.kernel.org # v4.6+
Diffstat (limited to 'drivers/pci/vc.c')
-rw-r--r-- | drivers/pci/vc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/vc.c b/drivers/pci/vc.c index dfbab61a1b47..1fa3a3219c45 100644 --- a/drivers/pci/vc.c +++ b/drivers/pci/vc.c @@ -221,9 +221,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 |