From: Heinz Mauelshagen Date: Mon, 18 Mar 2013 22:57:28 +0000 (+1100) Subject: Return error if cache_create() fails. X-Git-Tag: next-20130320~49^2~6 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=565b3e6b1b40e681aa1204107768bb1dff57dcc0;p=karo-tx-linux.git Return error if cache_create() fails. A missing return check made cache_ctr continue even after an error in cache_create() resulting in the cache object being destroyed. So a simple failure like an odd number of cache policy config value arguments would result in an oops. Signed-off-by: Heinz Mauelshagen Signed-off-by: Mike Snitzer Signed-off-by: Alasdair G Kergon --- diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 5ad227f0cea3..76cc910557f0 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -2009,6 +2009,8 @@ static int cache_ctr(struct dm_target *ti, unsigned argc, char **argv) goto out; r = cache_create(ca, &cache); + if (r) + goto out; r = copy_ctr_args(cache, argc - 3, (const char **)argv + 3); if (r) {