From: Dmitry Monakhov Date: Fri, 19 Oct 2007 21:38:37 +0000 (+0100) Subject: dm crypt: drop device ref in ctr error path X-Git-Tag: v2.6.24-rc1~130^2~26 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=55b42c5ae9c048de25233434afc7b71b01bee9e6;p=linux-2.6-omap-h63xx.git dm crypt: drop device ref in ctr error path Add a missing 'dm_put_device' in an error path in crypt target constructor. Signed-off-by: Dmitry Monakhov Signed-off-by: Milan Broz Signed-off-by: Alasdair G Kergon --- diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 64fee90bb68..ecd9ef0418c 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -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 @@ -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: