diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-05-10 14:37:14 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-05-19 11:38:17 -0700 |
commit | 3dc73aa4030321924423ebc662dcf6f382fef5b3 (patch) | |
tree | c8b02a37023e20b40c5caf141cf7e6c96582cca9 /drivers | |
parent | 62253ab07cbbb924ba69cbb4e050b42b008a6884 (diff) |
dm cache: fix error return code in cache_create
commit fa4d683af3693863bec761e2761a07e4c1351f86 upstream.
Return -ENOMEM if memory allocation fails in cache_create
instead of 0 (to avoid NULL pointer dereference).
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-cache-target.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 10744091e6c..6feaba24fca 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -1971,6 +1971,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) atomic_set(&cache->nr_migrations, 0); init_waitqueue_head(&cache->migration_wait); + r = -ENOMEM; cache->nr_dirty = 0; cache->dirty_bitset = alloc_bitset(from_cblock(cache->cache_size)); if (!cache->dirty_bitset) { |