diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2015-02-26 03:55:03 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-03-06 13:30:23 -0500 |
commit | a1b7f2f6367944d445c6853035830a35c6343939 (patch) | |
tree | 2e6f5112ff81f65cbcae5490988ce1724ec5fe90 /drivers/pci/pcie/aer/aerdrv_errprint.c | |
parent | a43f32d647273023edddb0dc8f91c4c6378b252b (diff) |
PCI/AER: Avoid info leak in __print_tlp_header()
Commit fab4c256a58b ("PCI/AER: Add a TLP header print helper") introduced
the helper function __print_tlp_header(), but contrary to the intention,
the behaviour did change: Since we're taking the address of the parameter
t, the first 4 or 8 bytes printed will be the value of the pointer t
itself, and the remaining 12 or 8 bytes will be who-knows-what (something
from the stack).
We want to show the values of the four members of the struct
aer_header_log_regs; that can be done without ugly and error-prone casts.
On little-endian this should produce the same output as originally
intended, and since no-one has complained about getting garbage output so
far, I think big-endian should be ok too.
Fixes: fab4c256a58b ("PCI/AER: Add a TLP header print helper")
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Borislav Petkov <bp@suse.de>
CC: stable@vger.kernel.org # v3.14+
Diffstat (limited to 'drivers/pci/pcie/aer/aerdrv_errprint.c')
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv_errprint.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index c6849d9e86ce..167fe411ce2e 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c | |||
@@ -132,16 +132,8 @@ static const char *aer_agent_string[] = { | |||
132 | static void __print_tlp_header(struct pci_dev *dev, | 132 | static void __print_tlp_header(struct pci_dev *dev, |
133 | struct aer_header_log_regs *t) | 133 | struct aer_header_log_regs *t) |
134 | { | 134 | { |
135 | unsigned char *tlp = (unsigned char *)&t; | 135 | dev_err(&dev->dev, " TLP Header: %08x %08x %08x %08x\n", |
136 | 136 | t->dw0, t->dw1, t->dw2, t->dw3); | |
137 | dev_err(&dev->dev, " TLP Header:" | ||
138 | " %02x%02x%02x%02x %02x%02x%02x%02x" | ||
139 | " %02x%02x%02x%02x %02x%02x%02x%02x\n", | ||
140 | *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, | ||
141 | *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), | ||
142 | *(tlp + 11), *(tlp + 10), *(tlp + 9), | ||
143 | *(tlp + 8), *(tlp + 15), *(tlp + 14), | ||
144 | *(tlp + 13), *(tlp + 12)); | ||
145 | } | 137 | } |
146 | 138 | ||
147 | static void __aer_print_error(struct pci_dev *dev, | 139 | static void __aer_print_error(struct pci_dev *dev, |