Skip to content

Commit

Permalink
dm cache: detect cache_create failure
Browse files Browse the repository at this point in the history
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 <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
  • Loading branch information
Heinz Mauelshagen authored and Alasdair G Kergon committed Mar 20, 2013
1 parent 414dd67 commit 617a0b8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/md/dm-cache-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 617a0b8

Please sign in to comment.