From: Greg KH <greg@kroah.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [PATCH] drivers/scsi/qlogicfc.c: It's changes
Date: Thu, 07 Jul 2005 19:01:38 +0000 [thread overview]
Message-ID: <20050707190137.GA19438@kroah.com> (raw)
In-Reply-To: <20050707010526.GA5406@garfield.casa.sp.br>
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
On Wed, Jul 06, 2005 at 10:05:26PM -0300, Rodrigo P. do Nascimento wrote:
> Hi All,
>
> I'm trying again. This time I checked whether the code isn't into the
> #ifdef or #ifndef block. :)
> I hope that it's right. My apologies whether something is wrong. I only
> want to help the project.
> I'm a newbie, so far. :)
Nice try, but here is why this task is so tough :(
This patch will leak a reference count for the pci device.
> --- /usr/src/linux/drivers/scsi/qlogicfc.c 2005-06-22 16:33:05.000000000 -0300
> +++ /usr/src/linux-kj/drivers/scsi/qlogicfc.c 2005-07-05 19:03:39.000000000 -0300
> @@ -732,7 +732,7 @@ static int isp2x00_detect(Scsi_Host_Temp
>
> for (i=0; i<2; i++){
> pdev = NULL;
> - while ((pdev = pci_find_device(PCI_VENDOR_ID_QLOGIC, device_ids[i], pdev))) {
> + while ((pdev = pci_get_device(PCI_VENDOR_ID_QLOGIC, device_ids[i], pdev))) {
Please read the description of how pci_get_device() works. In short it
increments the reference count of the pci_dev that is returned. Later
on in this function, that pointer is saved off into a structure, which
is fine. Problem happens when that larger structure is freed when the
device or driver is removed. You need to decrement the usage count of
that structure at that point in time.
Care to redo this?
thanks,
greg k-h
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2005-07-07 19:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-07 1:05 [KJ] [PATCH] drivers/scsi/qlogicfc.c: It's changes pci_find_device Rodrigo P. do Nascimento
2005-07-07 19:01 ` Greg KH [this message]
2005-07-07 19:25 ` [KJ] [PATCH] drivers/scsi/qlogicfc.c: It's changes Matthew Wilcox
2005-07-07 20:56 ` Greg KH
2005-07-07 21:23 ` Patrick Mansfield
2005-07-07 21:40 ` Rodrigo Nascimento
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=20050707190137.GA19438@kroah.com \
--to=greg@kroah.com \
--cc=kernel-janitors@vger.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.