mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 13:51:44 +00:00
powerpc/eeh: Fix possible null deref in eeh_dump_dev_log()
If an error occurs during an unplug operation, it's possible for eeh_dump_dev_log() to be called when edev->pdn is null, which currently leads to dereferencing a null pointer. Handle this by skipping the error log for those devices. Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
747b217608
commit
f9bc28aedf
@ -169,6 +169,11 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len)
|
||||
int n = 0, l = 0;
|
||||
char buffer[128];
|
||||
|
||||
if (!pdn) {
|
||||
pr_warn("EEH: Note: No error log for absent device.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
n += scnprintf(buf+n, len-n, "%04x:%02x:%02x.%01x\n",
|
||||
pdn->phb->global_number, pdn->busno,
|
||||
PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));
|
||||
|
Loading…
Reference in New Issue
Block a user