From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: linux-ide@vger.kernel.org
Subject: Re: Bad module reference counter
Date: Wed, 18 Feb 2009 22:25:19 +0100 [thread overview]
Message-ID: <200902182225.19784.bzolnier@gmail.com> (raw)
In-Reply-To: <200902111032.59225.stf_xl@wp.pl>
On Wednesday 11 February 2009, Stanislaw Gruszka wrote:
> Hello.
>
> I entered a problem with double decreasing module reference counter
> where it become "negative", here is the usage scenario:
>
> # modprobe at91_ide
> # modprobe ide_gd_mod
> # lsmod
> Module Size Used by Not tainted
> ide_gd_mod 22948 0
> at91_ide 4672 0
> ide_core 77020 2 ide_gd_mod,at91_ide
> # rmmod ide_gd_mod
> # lsmod
> Module Size Used by Not tainted
> at91_ide 4672 4294967295
> ide_core 77020 1 at91_ide
>
> Note when I first remove at91_ide module and then ide_gd_mod
> everyting is ok.
>
> I tired to debug issue and I did not found any suspicious in at91_ide.
> I think probable reason is double free in ide-gd.c . Here is patch with
> workaround (or maybe it is a real fix, but I'm not sure):
>
> diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
> index 7857b20..31ae04e 100644
> --- a/drivers/ide/ide-gd.c
> +++ b/drivers/ide/ide-gd.c
> @@ -70,8 +70,6 @@ static void ide_gd_remove(ide_drive_t *drive)
> del_gendisk(g);
>
> drive->disk_ops->flush(drive);
> -
> - ide_disk_put(idkp);
> }
>
> static void ide_disk_release(struct kref *kref)
>
> If this patch is ok, maybe similar things need to be done also in ide-cd and
> perhaps other device type modules.
Seems like ide_device_put() needs the same module_refcount() check that
is present in scsi_device_put() so removal of device driver won't trigger
a spurious module_put() on a host driver?
Thanks,
Bart
next prev parent reply other threads:[~2009-02-18 21:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-11 9:32 Bad module reference counter Stanislaw Gruszka
2009-02-18 21:25 ` Bartlomiej Zolnierkiewicz [this message]
2009-02-19 12:48 ` Stanislaw Gruszka
2009-02-19 16:49 ` Bartlomiej Zolnierkiewicz
2009-02-20 10:45 ` Stanislaw Gruszka
2009-02-23 22:36 ` Bartlomiej Zolnierkiewicz
2009-02-25 11:00 ` Stanislaw Gruszka
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=200902182225.19784.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=stf_xl@wp.pl \
/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;
as well as URLs for NNTP newsgroup(s).