Commit bc553993 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] dm: Zero size target sanity check

From: Joe Thornber <thornber@redhat.com>

Add sanity check to dm_table_add_target() against zero length targets.
[Christophe Saout]
parent 2c2eae81
...@@ -655,6 +655,11 @@ int dm_table_add_target(struct dm_table *t, const char *type, ...@@ -655,6 +655,11 @@ int dm_table_add_target(struct dm_table *t, const char *type,
memset(tgt, 0, sizeof(*tgt)); memset(tgt, 0, sizeof(*tgt));
set_default_limits(&tgt->limits); set_default_limits(&tgt->limits);
if (!len) {
tgt->error = "zero-length target";
return -EINVAL;
}
tgt->type = dm_get_target_type(type); tgt->type = dm_get_target_type(type);
if (!tgt->type) { if (!tgt->type) {
tgt->error = "unknown target type"; tgt->error = "unknown target type";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment