Skip to content

Commit

Permalink
dm crypt: drop device ref in ctr error path
Browse files Browse the repository at this point in the history
Add a missing 'dm_put_device' in an error path in crypt target constructor.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
  • Loading branch information
Dmitry Monakhov authored and Alasdair G Kergon committed Oct 20, 2007
1 parent 027d50f commit 55b42c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/md/dm-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL);
if (!cc->iv_mode) {
ti->error = "Error kmallocing iv_mode string";
goto bad5;
goto bad_iv_mode;
}
strcpy(cc->iv_mode, ivmode);
} else
Expand All @@ -870,6 +870,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
ti->private = cc;
return 0;

bad_iv_mode:
dm_put_device(ti, cc->dev);
bad5:
bioset_free(cc->bs);
bad_bs:
Expand Down

0 comments on commit 55b42c5

Please sign in to comment.