[Bugme-janitors] [Bug 9482] kernel GPF in 2.6.24 (g09f345da)

bugme-daemon at bugzilla.kernel.org bugme-daemon at bugzilla.kernel.org
Mon Dec 3 15:14:31 PST 2007


http://bugzilla.kernel.org/show_bug.cgi?id=9482





------- Comment #10 from anonymous at kernel-bugs.osdl.org  2007-12-03 15:14 -------
Reply-To: akpm at linux-foundation.org

On Mon, 3 Dec 2007 14:47:22 -0800
Andrew Morton <akpm at linux-foundation.org> wrote:

> Does this fix?

Slightly more elaborate version

- handle errors

- don't do illegal things under spinlock

- clean up error unwinding

---
a/drivers/block/aoe/aoeblk.c~aoe-properly-initialise-the-request_queues-backing_dev_info
+++ a/drivers/block/aoe/aoeblk.c
@@ -6,6 +6,7 @@

 #include <linux/hdreg.h>
 #include <linux/blkdev.h>
+#include <linux/backing-dev.h>
 #include <linux/fs.h>
 #include <linux/ioctl.h>
 #include <linux/genhd.h>
@@ -210,25 +211,20 @@ aoeblk_gdalloc(void *vp)
        if (gd == NULL) {
                printk(KERN_ERR "aoe: cannot allocate disk structure for
%ld.%ld\n",
                        d->aoemajor, d->aoeminor);
-               spin_lock_irqsave(&d->lock, flags);
-               d->flags &= ~DEVFL_GDALLOC;
-               spin_unlock_irqrestore(&d->lock, flags);
-               return;
+               goto err;
        }

        d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
        if (d->bufpool == NULL) {
                printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n",
                        d->aoemajor, d->aoeminor);
-               put_disk(gd);
-               spin_lock_irqsave(&d->lock, flags);
-               d->flags &= ~DEVFL_GDALLOC;
-               spin_unlock_irqrestore(&d->lock, flags);
-               return;
+               goto err_disk;
        }

-       spin_lock_irqsave(&d->lock, flags);
        blk_queue_make_request(&d->blkq, aoeblk_make_request);
+       if (bdi_init(&d->blkq.backing_dev_info))
+               goto err_mempool;
+       spin_lock_irqsave(&d->lock, flags);
        gd->major = AOE_MAJOR;
        gd->first_minor = d->sysminor * AOE_PARTITIONS;
        gd->fops = &aoe_bdops;
@@ -246,6 +242,16 @@ aoeblk_gdalloc(void *vp)

        add_disk(gd);
        aoedisk_add_sysfs(d);
+       return;
+
+err_mempool:
+       mempool_destroy(d->bufpool);
+err_disk:
+       put_disk(gd);
+err:
+       spin_lock_irqsave(&d->lock, flags);
+       d->flags &= ~DEVFL_GDALLOC;
+       spin_unlock_irqrestore(&d->lock, flags);
 }

 void
_


It was done lackadaisically and needs checking.


-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Bugme-janitors mailing list