mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* pcie aspm link setup, grandparent instead of parent?
@ 2013-06-12 17:21 Radim Krčmář
  2013-06-12 21:54 ` Bjorn Helgaas
  0 siblings, 1 reply; 3+ messages in thread
From: Radim Krčmář @ 2013-06-12 17:21 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Kenji Kaneshige

Hello,

as a consequence of hitting a NULL dereference bug[1] while downstream
aspm is setting up link_state, I started to wonder why is the code
skipping its parent bus in favour of grandparent's link_state.[2]

Is this right? (I have no device to test on ...)

Thanks.

---
1: https://bugzilla.redhat.com/show_bug.cgi?id=972381
   The bug is hit because "pdev->bus->parent" has NULL "->parent" and thus
   NULL "->self".
2: "pdev = bus->self", so "pdev->bus->parent == bus->parent->parent"


diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 403a443..d58e282 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -527,7 +527,7 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
 	link->pdev = pdev;
 	if (pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM) {
 		struct pcie_link_state *parent;
-		parent = pdev->bus->parent->self->link_state;
+		parent = pdev->bus->self->link_state;
 		if (!parent) {
 			kfree(link);
 			return NULL;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-13 10:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-12 17:21 pcie aspm link setup, grandparent instead of parent? Radim Krčmář
2013-06-12 21:54 ` Bjorn Helgaas
2013-06-13 10:09   ` Radim Krčmář

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®