mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@engr.sgi.com>
To: MUNEDA Takahiro <muneda.takahiro@jp.fujitsu.com>
Cc: Greg KH <greg@kroah.com>, John Rose <johnrose@austin.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-pci <linux-pci@atrey.karlin.mff.cuni.cz>
Subject: Re: [PATCH] PCI: fix pci_remove_legacy_files() crash
Date: Fri, 4 Feb 2005 08:45:44 -0800	[thread overview]
Message-ID: <200502040845.44954.jbarnes@engr.sgi.com> (raw)
In-Reply-To: <87zmyl2ecb.wl%muneda.takahiro@jp.fujitsu.com>

On Thursday, February 3, 2005 7:28 pm, MUNEDA Takahiro wrote:
> Hi,
>
> The legacy_io which is the member of pci_bus struct might be
> NULL. It should be checked.
>
> This patch checks 'b->legacy_io', NULL or not.
>
> Signed-off-by: MUNEDA Takahiro <muneda.takahiro@jp.fujitsu.com>
>
> ---
>
>  probe.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff -Npur a/drivers/pci/probe.c b/drivers/pci/probe.c
> --- a/drivers/pci/probe.c 2005-01-31 13:31:27.000000000 +0900
> +++ b/drivers/pci/probe.c 2005-02-03 11:21:51.000000000 +0900
> @@ -64,9 +64,11 @@ static void pci_create_legacy_files(stru
>
>  void pci_remove_legacy_files(struct pci_bus *b)
>  {
> - class_device_remove_bin_file(&b->class_dev, b->legacy_io);
> - class_device_remove_bin_file(&b->class_dev, b->legacy_mem);
> - kfree(b->legacy_io); /* both are allocated here */
> + if (b->legacy_io) {
> +  class_device_remove_bin_file(&b->class_dev, b->legacy_io);
> +  class_device_remove_bin_file(&b->class_dev, b->legacy_mem);
> +  kfree(b->legacy_io); /* both are allocated here */
> + }
>  }
>  #else /* !HAVE_PCI_LEGACY */
>  static inline void pci_create_legacy_files(struct pci_bus *bus) { return;
> }

Thanks, though the case where b->legacy_io is NULL should be very rare (it'll 
only happen if the initialization can't get memory for b->legacy_io), it's 
still a possibility so this fix is needed.

Acked-by: Jesse Barnes <jbarnes@sgi.com>

  reply	other threads:[~2005-02-04 16:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-04  3:28 MUNEDA Takahiro
2005-02-04 16:45 ` Jesse Barnes [this message]
2005-02-08  0:19 ` Greg KH
2005-03-04 20:53 [PATCH] PCI: Make pci_claim_resource __devinit Greg KH
2005-03-04 20:53 ` [PATCH] PCI: fix pci_remove_legacy_files() crash Greg KH

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=200502040845.44954.jbarnes@engr.sgi.com \
    --to=jbarnes@engr.sgi.com \
    --cc=greg@kroah.com \
    --cc=johnrose@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=muneda.takahiro@jp.fujitsu.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome