summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-table.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 2ec3482e942..9917141729e 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -774,6 +774,12 @@ int dm_table_add_target(struct dm_table *t, const char *type,
t->singleton = 1;
}
+ if (dm_target_always_writeable(tgt->type) && !(t->mode & FMODE_WRITE)) {
+ DMERR("%s: target type %s may not be included in read-only tables",
+ dm_device_name(t->md), type);
+ return -EINVAL;
+ }
+
tgt->table = t;
tgt->begin = start;
tgt->len = len;