lkml.org 
[lkml]   [2003]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Proposed module init race fix.
Hi,

Rusty Russell wrote:

> diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .17886-linux-2.5-bk/drivers/block/genhd.c .17886-linux-2.5-bk.updated/drivers/block/genhd.c
> --- .17886-linux-2.5-bk/drivers/block/genhd.c 2003-01-13 16:56:23.000000000 +1100
> +++ .17886-linux-2.5-bk.updated/drivers/block/genhd.c 2003-01-13 22:58:07.000000000 +1100
> @@ -104,10 +104,13 @@ static int exact_lock(dev_t dev, void *d
> * @gp: per-device partitioning information
> *
> * This function registers the partitioning information in @gp
> - * with the kernel.
> + * with the kernel. Your init function MUST NOT FAIL after this.
> */
> void add_disk(struct gendisk *disk)
> {
> + /* It needs to be accessible so we can read partitions. */
> + make_module_live(disk->fops->owner);
> +

After this the module can be removed without problems.

> disk->flags |= GENHD_FL_UP;
> blk_register_region(MKDEV(disk->major, disk->first_minor), disk->minors,
> NULL, exact_match, exact_lock, disk);

blk_register_region() allocates memory, which can fail?

bye, Roman


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.235 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site