From: Tejun Heo <htejun@gmail.com>
To: Peter Osterlund <petero2@telia.com>
Cc: Jens Axboe <jens.axboe@oracle.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Thomas Maier <balagi@justmail.de>,
gregkh@suse.de
Subject: Re: pktcdvd oops
Date: Tue, 06 Nov 2007 18:06:39 +0900 [thread overview]
Message-ID: <47302E9F.6020708@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0711052312410.5445@quad.localdomain>
[-- Attachment #1: Type: text/plain, Size: 740 bytes --]
[Greg cc'd]
Peter Osterlund wrote:
> On Mon, 5 Nov 2007, Jens Axboe wrote:
>
>> Hi Peter,
>>
>> You don't seem to have a bugzilla account, so could not reassign to you.
>> See http://bugzilla.kernel.org/show_bug.cgi?id=9294
>
> Problem is repeatable on my computer. It dies in __module_get() on this
> line:
>
> BUG_ON(module_refcount(module) == 0);
>
> I think this is because commit 7b595756ec1f49e0049a9e01a1298d53a7faaa15,
> which states: "Note that with this change, userland holding a sysfs node
> does not prevent the backing module from being unloaded."
>
> Unfortunately, I don't know how this sysfs stuff is supposed to work,
> and therefore don't know how to fix the problem.
Does this fix the problem?
--
tejun
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 601 bytes --]
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index a8130a4..a5ee213 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -358,10 +358,19 @@ static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf,
size_t count)
{
unsigned int major, minor;
+
if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
+ /* pkt_setup_dev() expects caller to hold reference to self */
+ if (!try_module_get(THIS_MODULE))
+ return -ENODEV;
+
pkt_setup_dev(MKDEV(major, minor), NULL);
+
+ module_put(THIS_MODULE);
+
return count;
}
+
return -EINVAL;
}
next prev parent reply other threads:[~2007-11-06 9:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071105092018.GD5359@kernel.dk>
2007-11-05 22:19 ` pktcdvd oops Peter Osterlund
2007-11-06 9:06 ` Tejun Heo [this message]
2007-11-06 21:07 ` Thomas Maier
2007-11-06 21:42 ` Peter Osterlund
2007-11-07 2:44 ` Tejun Heo
2007-11-07 22:06 ` Peter Osterlund
2007-11-08 2:27 ` [PATCH] pktcdvd: fix BUG caused by sysfs module reference semantics change Tejun Heo
2007-11-08 5:24 ` Greg KH
2007-11-08 6:55 ` Tejun Heo
2007-11-08 6:59 ` Jens Axboe
2007-11-08 9:08 Re: pktcdvd oops balagi
2007-11-08 9:34 ` Tejun Heo
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=47302E9F.6020708@gmail.com \
--to=htejun@gmail.com \
--cc=balagi@justmail.de \
--cc=gregkh@suse.de \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=petero2@telia.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