[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090522113622.GA14692@parisc-linux.org>
Date: Fri, 22 May 2009 05:36:22 -0600
From: Matthew Wilcox <matthew@....cx>
To: Alex Chiang <achiang@...com>
Cc: Jesse Barnes <jbarnes@...tuousgeek.org>, bjorn.helgaas@...com,
kaneshige.kenji@...fujitsu.com,
linux-pci <linux-pci@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] PCI Hotplug: acpiphp: don't store a pci_dev in
acpiphp_func
On Thu, May 21, 2009 at 04:21:15PM -0600, Alex Chiang wrote:
> In other words, if acpiphp has claimed a PCI device, and that
> device is logically removed, then acpiphp may oops when it
> attempts to access it again.
>
> # echo 1 > /sys/bus/pci/devices/$device/remove
> # echo 0 > /sys/bus/pci/slots/$slot/power
>
> The root cause of this oops is that the logical remove ("echo 1 >
> /sys/bus/pci/devices/$device/remove") destroyed the pci_dev. The
> pci_dev struct itself wasn't deallocated because acpiphp kept a
> reference, but some of its fields became invalid.
>
> acpiphp doesn't have any real reason to keep a pointer to a
> pci_dev around. It can always derive it using pci_get_slot().
>
> If a logical remove destroys the pci_dev, acpiphp won't find it
> and is thus prevented from causing mischief.
>
> Reported-by: Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>
> Acked-by: Bjorn Helgaas <bjorn.helgaas@...com>
> Signed-off-by: Alex Chiang <achiang@...com>
I think this is the right approach. The more minimal way to fix this
would be to check that the pdev was valid before destroying it ... but
I approve of deleting more code from acpiphp ;-) You do end up doing
slightly more work in the remove case, but this is such an infrequent
operation that it really doesn't matter.
Reviewed-by: Matthew Wilcox <willy@...ux.intel.com>
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists