All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Jiang Liu <liuj97@gmail.com>
Cc: Yinghai Lu <yinghai@kernel.org>,
	Gu Zheng <guz.fnst@cn.fujitsu.com>,
	"Rafael J . Wysocki" <rjw@sisk.pl>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Toshi Kani <toshi.kani@hp.com>,
	Myron Stowe <myron.stowe@redhat.com>,
	Yijing Wang <wangyijing@huawei.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jiang Liu <jiang.liu@huawei.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	"David S. Miller" <davem@davemloft.net>,
	David Airlie <airlied@linux.ie>,
	Neela Syam Kolli <megaraidlinux@lsi.com>,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	sparclinux@vger.kernel.org,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH v3, part1 03/10] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead
Date: Wed, 5 Jun 2013 14:07:18 -0600	[thread overview]
Message-ID: <CAErSpo6C-QMFCbMMivBE5TN4sEOFR_EyPmtN=OUNo8eN-+t=GQ@mail.gmail.com> (raw)
In-Reply-To: <1369489718-25869-4-git-send-email-jiang.liu@huawei.com>

On Sat, May 25, 2013 at 7:48 AM, Jiang Liu <liuj97@gmail.com> wrote:
> From: Gu Zheng <guz.fnst@cn.fujitsu.com>
>
> Use the new pci_alloc_dev(bus) to replace the existing using of
> alloc_pci_dev(void).
> ...

> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 26df9c8..d5d18a0 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1130,6 +1130,7 @@ static void pci_release_dev(struct device *dev)
>         struct pci_dev *pci_dev;
>
>         pci_dev = to_pci_dev(dev);
> +       pci_bus_put(pci_dev->bus);
>         pci_release_capabilities(pci_dev);
>         pci_release_of_node(pci_dev);
>         kfree(pci_dev);

I think we should drop the pci_bus reference *last* (before the
kfree).  Otherwise, we have to audit pci_release_capabilities() and
pci_release_of_node() to make sure they don't use pci_dev->bus.

I made this change on my branch already; just let me know if you object.

Bjorn

WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <bhelgaas@google.com>
To: Jiang Liu <liuj97@gmail.com>
Cc: Yinghai Lu <yinghai@kernel.org>,
	Gu Zheng <guz.fnst@cn.fujitsu.com>,
	"Rafael J . Wysocki" <rjw@sisk.pl>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Toshi Kani <toshi.kani@hp.com>,
	Myron Stowe <myron.stowe@redhat.com>,
	Yijing Wang <wangyijing@huawei.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jiang Liu <jiang.liu@huawei.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	"David S. Miller" <davem@davemloft.net>,
	David Airlie <airlied@linux.ie>,
	Neela Syam Kolli <megaraidlinux@lsi.com>,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	sparclinux@vger.kernel.org,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH v3, part1 03/10] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead
Date: Wed, 05 Jun 2013 20:07:18 +0000	[thread overview]
Message-ID: <CAErSpo6C-QMFCbMMivBE5TN4sEOFR_EyPmtN=OUNo8eN-+t=GQ@mail.gmail.com> (raw)
In-Reply-To: <1369489718-25869-4-git-send-email-jiang.liu@huawei.com>

On Sat, May 25, 2013 at 7:48 AM, Jiang Liu <liuj97@gmail.com> wrote:
> From: Gu Zheng <guz.fnst@cn.fujitsu.com>
>
> Use the new pci_alloc_dev(bus) to replace the existing using of
> alloc_pci_dev(void).
> ...

> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 26df9c8..d5d18a0 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1130,6 +1130,7 @@ static void pci_release_dev(struct device *dev)
>         struct pci_dev *pci_dev;
>
>         pci_dev = to_pci_dev(dev);
> +       pci_bus_put(pci_dev->bus);
>         pci_release_capabilities(pci_dev);
>         pci_release_of_node(pci_dev);
>         kfree(pci_dev);

I think we should drop the pci_bus reference *last* (before the
kfree).  Otherwise, we have to audit pci_release_capabilities() and
pci_release_of_node() to make sure they don't use pci_dev->bus.

I made this change on my branch already; just let me know if you object.

Bjorn

WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <bhelgaas@google.com>
To: Jiang Liu <liuj97@gmail.com>
Cc: Neela Syam Kolli <megaraidlinux@lsi.com>,
	sparclinux@vger.kernel.org, Toshi Kani <toshi.kani@hp.com>,
	Jiang Liu <jiang.liu@huawei.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	David Airlie <airlied@linux.ie>,
	Myron Stowe <myron.stowe@redhat.com>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	"Rafael J . Wysocki" <rjw@sisk.pl>,
	Yijing Wang <wangyijing@huawei.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Gu Zheng <guz.fnst@cn.fujitsu.com>,
	Paul Mackerras <paulus@samba.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Yinghai Lu <yinghai@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v3, part1 03/10] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead
Date: Wed, 5 Jun 2013 14:07:18 -0600	[thread overview]
Message-ID: <CAErSpo6C-QMFCbMMivBE5TN4sEOFR_EyPmtN=OUNo8eN-+t=GQ@mail.gmail.com> (raw)
In-Reply-To: <1369489718-25869-4-git-send-email-jiang.liu@huawei.com>

On Sat, May 25, 2013 at 7:48 AM, Jiang Liu <liuj97@gmail.com> wrote:
> From: Gu Zheng <guz.fnst@cn.fujitsu.com>
>
> Use the new pci_alloc_dev(bus) to replace the existing using of
> alloc_pci_dev(void).
> ...

> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 26df9c8..d5d18a0 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1130,6 +1130,7 @@ static void pci_release_dev(struct device *dev)
>         struct pci_dev *pci_dev;
>
>         pci_dev = to_pci_dev(dev);
> +       pci_bus_put(pci_dev->bus);
>         pci_release_capabilities(pci_dev);
>         pci_release_of_node(pci_dev);
>         kfree(pci_dev);

I think we should drop the pci_bus reference *last* (before the
kfree).  Otherwise, we have to audit pci_release_capabilities() and
pci_release_of_node() to make sure they don't use pci_dev->bus.

I made this change on my branch already; just let me know if you object.

Bjorn

  reply	other threads:[~2013-06-05 20:07 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-25 13:48 [PATCH v3, part1 00/10] Prepare for introducing PCI bus lock interfaces Jiang Liu
2013-05-25 13:48 ` [PATCH v3, part1 01/10] PCI: introduce pci_bus_{get|put}() to manage PCI bus reference count Jiang Liu
2013-05-25 13:48 ` [PATCH v3, part1 02/10] PCI: Introduce pci_alloc_dev(struct pci_bus*) to replace alloc_pci_dev() Jiang Liu
2013-05-25 13:48 ` [PATCH v3, part1 03/10] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead Jiang Liu
2013-05-25 13:48   ` Jiang Liu
2013-05-25 13:48   ` Jiang Liu
2013-06-05 20:07   ` Bjorn Helgaas [this message]
2013-06-05 20:07     ` Bjorn Helgaas
2013-06-05 20:07     ` Bjorn Helgaas
2013-06-06 16:16     ` Jiang Liu
2013-06-06 16:16       ` Jiang Liu
2013-06-06 16:16       ` Jiang Liu
2013-05-25 13:48 ` [PATCH v3, part1 04/10] PCI: mark pci_scan_bus_parented() as __deprecated Jiang Liu
2013-05-31 20:12   ` Chris Metcalf
2013-06-05 20:04   ` Bjorn Helgaas
2013-06-06 16:32     ` Jiang Liu
2013-06-07 14:37       ` Konrad Rzeszutek Wilk
2013-06-07 15:11         ` Jiang Liu
2013-06-07 15:30         ` Jiang Liu
2013-06-07 20:37           ` Bjorn Helgaas
2013-05-25 13:48 ` [PATCH v3, part1 05/10] PCI, IA64: minor code clean up Jiang Liu
2013-05-25 13:48   ` Jiang Liu
2013-05-25 13:48 ` [PATCH v3, part1 06/10] PCI: make PCI host bridge/bus creating and destroying logic symmetric Jiang Liu
2013-06-05 20:14   ` Bjorn Helgaas
2013-06-06 17:10     ` [PATCH 1/2] PCI: fix a double free issue in pci_create_root_bus() error recovery path Jiang Liu
2013-06-08  1:42       ` Bjorn Helgaas
2013-06-06 17:10     ` [PATCH 2/2] PCI: make PCI host bridge/bus creating and destroying logic symmetric Jiang Liu
2013-06-06 20:01       ` Yinghai Lu
2013-06-08  1:51         ` Bjorn Helgaas
2013-06-08  7:01           ` Yinghai Lu
2013-06-14 23:53             ` Bjorn Helgaas
2013-06-15  1:46               ` Jiang Liu
2013-05-25 13:48 ` [PATCH v3, part1 07/10] PCI, unicore, m68k: remove redundant call of pci_bus_add_devices() Jiang Liu
2013-06-05 21:31   ` Bjorn Helgaas
2013-06-05 21:31     ` Bjorn Helgaas
2013-06-06  6:54     ` Greg Ungerer
2013-06-06  6:54       ` Greg Ungerer
2013-06-05 21:31   ` Bjorn Helgaas
2013-05-25 13:48 ` [PATCH v3, part1 08/10] PCI, IOV: don't touch bus->is_added flag Jiang Liu
2013-05-25 13:48 ` [PATCH v3, part1 09/10] PCI, IOV: simplify IOV implementation Jiang Liu
2013-05-28  2:00   ` Yinghai Lu
2013-05-28 14:48     ` Liu Jiang
2013-05-30  4:31   ` [PATCH] PCI, IOV: fix a resource leakage on error recovery path Jiang Liu
2013-05-30 18:24     ` Bjorn Helgaas
2013-05-25 13:48 ` [PATCH v3, part1 10/10] PCI, IOV: hide remove and rescan sysfs interfaces for SR-IOV virtual functions Jiang Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAErSpo6C-QMFCbMMivBE5TN4sEOFR_EyPmtN=OUNo8eN-+t=GQ@mail.gmail.com' \
    --to=bhelgaas@google.com \
    --cc=JBottomley@parallels.com \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=guz.fnst@cn.fujitsu.com \
    --cc=jiang.liu@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=liuj97@gmail.com \
    --cc=megaraidlinux@lsi.com \
    --cc=myron.stowe@redhat.com \
    --cc=paulus@samba.org \
    --cc=rjw@sisk.pl \
    --cc=sparclinux@vger.kernel.org \
    --cc=toshi.kani@hp.com \
    --cc=wangyijing@huawei.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.