lkml.org 
[lkml]   [2018]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 306/328] dm cache: destroy migration_cache if cache target registration failed
    3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Shenghui Wang <shhuiw@foxmail.com>

    commit c7cd55504a5b0fc826a2cd9540845979d24ae542 upstream.

    Commit 7e6358d244e47 ("dm: fix various targets to dm_register_target
    after module __init resources created") inadvertently introduced this
    bug when it moved dm_register_target() after the call to KMEM_CACHE().

    Fixes: 7e6358d244e47 ("dm: fix various targets to dm_register_target after module __init resources created")
    Signed-off-by: Shenghui Wang <shhuiw@foxmail.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    drivers/md/dm-cache-target.c | 5 ++---
    1 file changed, 2 insertions(+), 3 deletions(-)

    --- a/drivers/md/dm-cache-target.c
    +++ b/drivers/md/dm-cache-target.c
    @@ -3109,14 +3109,13 @@ static int __init dm_cache_init(void)
    int r;

    migration_cache = KMEM_CACHE(dm_cache_migration, 0);
    - if (!migration_cache) {
    - dm_unregister_target(&cache_target);
    + if (!migration_cache)
    return -ENOMEM;
    - }

    r = dm_register_target(&cache_target);
    if (r) {
    DMERR("cache target registration failed: %d", r);
    + kmem_cache_destroy(migration_cache);
    return r;
    }

    \
     
     \ /
      Last update: 2018-12-09 23:20    [W:2.114 / U:0.324 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site