Commit ef0dab4a authored by David Miller's avatar David Miller Committed by Bjorn Helgaas

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: 5f8fc432 ("PCI: Include pci/pcie/Kconfig directly from pci/Kconfig")
Reported-by: default avatarMeelis Roos <mroos@linux.ee>
Reported-by: default avatarAnatoly Pugachev <matorola@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
CC: stable@vger.kernel.org	# v4.6+
parent af8c34ce
...@@ -221,9 +221,9 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos, ...@@ -221,9 +221,9 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos,
else else
pci_write_config_word(dev, pos + PCI_VC_PORT_CTRL, pci_write_config_word(dev, pos + PCI_VC_PORT_CTRL,
*(u16 *)buf); *(u16 *)buf);
buf += 2; buf += 4;
} }
len += 2; len += 4;
/* /*
* If we have any Low Priority VCs and a VC Arbitration Table Offset * If we have any Low Priority VCs and a VC Arbitration Table Offset
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment