From: Andres Salomon <dilinger@mp3revolution.net>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] 2.5.44 Fix uninitialized device struct w/ add_disk()
Date: Sat, 19 Oct 2002 04:11:01 -0400 [thread overview]
Message-ID: <20021019081101.GA5149@chunk.voxel.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 862 bytes --]
This occurs w/ 2.5 device-mapper; add_disk() is called (w/ a possibly
invalid gendisk). add_disk() calls register_disk(), which constructs
the device struct (gendisk::disk_dev). First, the bus_id field is
initialized, and then device_add() is called. However, device_add()
does no initialization of the device struct. So, since the
gendisk::disk_dev::parent list is NULL, the gendisk::disk_dev::node
field is never initialized. Later on in device_add(), if an error has
occurred, list_del_init(&dev->node) is called; dev->node is {NULL,NULL},
and an oops occurs.
Instead of calling device_add(), my patch makes register_disk() call
device_register(). This appear to do the same thing as device_add(),
but initializes the device struct before calling device_add().
--
It's not denial. I'm just selective about the reality I accept.
-- Bill Watterson
[-- Attachment #2: check.c.diff --]
[-- Type: text/plain, Size: 377 bytes --]
--- a/fs/partitions/check.c 2002-10-19 03:56:00.000000000 -0400
+++ a/fs/partitions/check.c 2002-10-19 03:56:10.000000000 -0400
@@ -455,7 +455,7 @@
s = strchr(dev->bus_id, '/');
if (s)
*s = '!';
- device_add(dev);
+ device_register(dev);
device_create_file(dev, &disk_attr_dev);
device_create_file(dev, &disk_attr_range);
device_create_file(dev, &disk_attr_size);
next reply other threads:[~2002-10-19 8:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-19 8:11 Andres Salomon [this message]
2002-10-19 8:53 ` Alexander Viro
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=20021019081101.GA5149@chunk.voxel.net \
--to=dilinger@mp3revolution.net \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®