Skip to contentSkip to conversation

sdhci driver produces kernel oops on ejecting the card

DISCUSSION Mikkel Erup 2 participants 2 messages Apr 11, 2006 – Apr 12, 2006

lore
Share & tools
lore
#0 lore raw
Quoted 42 lines
Quoted 8 lines · --- Russell King

So the
only place for sane
refcounting seems to be genhd.c, as per the patch
below.

Comments?

diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk

-x

block/genhd.c static int exact_lock(dev_t

Quoted 5 lines

*.orig -x *.rej -x .git a/block/genhd.c
b/block/genhd.c

block/genhd.c +0 -0
@@ -262,6 +262,7 @@ static int exact_lock(dev_t

dev,

Quoted 9 lines

void *d
*/
void add_disk(struct gendisk *disk)
{

block/genhd.c +1 -0
+	get_device(disk->driverfs_dev);
 	disk->flags |= GENHD_FL_UP;
 	blk_register_region(MKDEV(disk->major,

disk->first_minor),
disk->minors, NULL, exact_match,

exact_lock,

block/genhd.c

Quoted 10 lines

disk);

block/genhd.c +0 -0
@@ -507,6 +508,7 @@ static struct attribute *

default_attrs[
static void disk_release(struct kobject * kobj)
{

block/genhd.c +1 -0
 	struct gendisk *disk = to_disk(kobj);
+	put_device(disk->driverfs_dev);
 	kfree(disk->random);
 	kfree(disk->part);
 	free_disk_stats(disk);

I can confirm that this patch is working.
The 2.6.16-git20 kernel doesn't oops on
ejecting the card after the patch is applied.

Quoted 1 line

Mikkel

I didn't see anything regarding this on sdchi-devel or lkml for a week or so, so I thought I'd just make sure it's not forgotten. This patch works really well for me. The kernel no longer oopses on ejecting the card because a NULL pointer is no longer dereferenced and I think the patch should be considered.

Mikkel

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#1 lore raw
Quoted 42 lines · Mikkel Erup
Quoted 42 lines
Quoted 8 lines · --- Russell King

So the
only place for sane
refcounting seems to be genhd.c, as per the patch
below.

Comments?

diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk

-x

block/genhd.c static int exact_lock(dev_t

Quoted 5 lines

*.orig -x *.rej -x .git a/block/genhd.c
b/block/genhd.c

block/genhd.c +0 -0
@@ -262,6 +262,7 @@ static int exact_lock(dev_t

dev,

Quoted 9 lines

void *d
*/
void add_disk(struct gendisk *disk)
{

block/genhd.c +1 -0
+	get_device(disk->driverfs_dev);
 	disk->flags |= GENHD_FL_UP;
 	blk_register_region(MKDEV(disk->major,

disk->first_minor),
disk->minors, NULL, exact_match,

exact_lock,

block/genhd.c

Quoted 10 lines

disk);

block/genhd.c +0 -0
@@ -507,6 +508,7 @@ static struct attribute *

default_attrs[
static void disk_release(struct kobject * kobj)
{

block/genhd.c +1 -0
 	struct gendisk *disk = to_disk(kobj);
+	put_device(disk->driverfs_dev);
 	kfree(disk->random);
 	kfree(disk->part);
 	free_disk_stats(disk);

I can confirm that this patch is working.
The 2.6.16-git20 kernel doesn't oops on
ejecting the card after the patch is applied.

Quoted 7 lines
Quoted 1 line

Mikkel

I didn't see anything regarding this on sdchi-devel or lkml for a week or so, so I thought I'd just make sure it's not forgotten. This patch works really well for me. The kernel no longer oopses on ejecting the card because a NULL pointer is no longer dereferenced and I think the patch should be considered.

I think it needs someone like Al Viro or Jens Axboe to review it. I sent the patch to them originally, but when you replied, your mailer removed them from your reply.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core