Skip to content

Commit

Permalink
PCI: Fix unaligned accesses in VC code
Browse files Browse the repository at this point in the history
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: 5f8fc43 ("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+
  • Loading branch information
David Miller authored and Bjorn Helgaas committed Jun 20, 2016
1 parent af8c34c commit ef0dab4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/pci/vc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ef0dab4

Please sign in to comment.