提交 55b42c5a 编写于 作者: D Dmitry Monakhov 提交者: Alasdair G Kergon

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: NDmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: NMilan Broz <mbroz@redhat.com>
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
上级 027d50f9
...@@ -861,7 +861,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) ...@@ -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); cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL);
if (!cc->iv_mode) { if (!cc->iv_mode) {
ti->error = "Error kmallocing iv_mode string"; ti->error = "Error kmallocing iv_mode string";
goto bad5; goto bad_iv_mode;
} }
strcpy(cc->iv_mode, ivmode); strcpy(cc->iv_mode, ivmode);
} else } else
...@@ -870,6 +870,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) ...@@ -870,6 +870,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
ti->private = cc; ti->private = cc;
return 0; return 0;
bad_iv_mode:
dm_put_device(ti, cc->dev);
bad5: bad5:
bioset_free(cc->bs); bioset_free(cc->bs);
bad_bs: bad_bs:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册