[PATCH 1/3] block: fix add_partition() error path - Kernel

This is a discussion on [PATCH 1/3] block: fix add_partition() error path - Kernel ; Partition stats structure was not freed on devt allocation failure path. Fix it. Signed-off-by: Tejun Heo --- fs/partitions/check.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: work/fs/partitions/check.c ================================================== ================= --- work.orig/fs/partitions/check.c +++ work/fs/partitions/check.c @@ -395,7 +395,7 @@ ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [PATCH 1/3] block: fix add_partition() error path

  1. [PATCH 1/3] block: fix add_partition() error path

    Partition stats structure was not freed on devt allocation failure
    path. Fix it.

    Signed-off-by: Tejun Heo
    ---
    fs/partitions/check.c | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    Index: work/fs/partitions/check.c
    ================================================== =================
    --- work.orig/fs/partitions/check.c
    +++ work/fs/partitions/check.c
    @@ -395,7 +395,7 @@ int add_partition(struct gendisk *disk,

    err = blk_alloc_devt(p, &devt);
    if (err)
    - goto out_free;
    + goto out_free_stats;
    pdev->devt = devt;

    /* delay uevent until 'holders' subdir is created */
    @@ -426,6 +426,8 @@ int add_partition(struct gendisk *disk,

    return 0;

    +out_free_stats:
    + free_part_stats(p);
    out_free:
    kfree(p);
    return err;
    --
    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/

  2. [PATCH 3/3] block/md: fix md autodetection

    Block ext devt conversion missed md_autodetect_dev() call in
    rescan_partitions() leaving md autodetect unable to see partitions.
    Fix it.

    Signed-off-by: Tejun Heo
    Cc: Neil Brown
    ---
    Oops, I forgot 2/3 in the subject of the second patch. Sorry.

    fs/partitions/check.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    Index: work/fs/partitions/check.c
    ================================================== =================
    --- work.orig/fs/partitions/check.c
    +++ work/fs/partitions/check.c
    @@ -577,7 +577,7 @@ int rescan_partitions(struct gendisk *di
    }
    #ifdef CONFIG_BLK_DEV_MD
    if (state->parts[p].flags & ADDPART_FLAG_RAID)
    - md_autodetect_dev(bdev->bd_dev+p);
    + md_autodetect_dev(part_to_dev(part)->devt);
    #endif
    }
    kfree(state);
    --
    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/

  3. Re: [PATCH 1/3] block: fix add_partition() error path

    On Mon, Nov 10 2008, Tejun Heo wrote:
    > Partition stats structure was not freed on devt allocation failure
    > path. Fix it.


    Thanks, applied 1-3 for 2.6.28

    --
    Jens Axboe

    --
    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/

+ Reply to Thread