]> sourceware.org Git - lvm2.git/commitdiff
bcache: Fix null pointer dereferencing
authorMarian Csontos <mcsontos@redhat.com>
Tue, 26 Jun 2018 15:04:18 +0000 (17:04 +0200)
committerMarian Csontos <mcsontos@redhat.com>
Tue, 26 Jun 2018 15:09:58 +0000 (17:09 +0200)
(cherry picked from commit a14f21bf1ddbb93b13a917cad8720fed6c94d6de)

Conflicts:
lib/device/bcache.c

lib/device/bcache.c

index 3b780474d75f5a038242fcbc5a2b1a2514ee46d5..c7c19097c3815919a68228cb36ae9df1a0cd2d15 100644 (file)
@@ -559,11 +559,13 @@ static bool _init_free_list(struct bcache *cache, unsigned count, unsigned pgsiz
        if (!data)
                return false;
 
-       cache->raw_data = data;
        cache->raw_blocks = dm_malloc(count * sizeof(*cache->raw_blocks));
-
        if (!cache->raw_blocks)
-               dm_free(cache->raw_data);
+               free(data);
+               return false;
+       }
+
+       cache->raw_data = data;
 
        for (i = 0; i < count; i++) {
                struct block *b = cache->raw_blocks + i;
This page took 0.031832 seconds and 5 git commands to generate.