diff options
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r-- | drivers/md/dm-table.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 2ec3482e942a..9917141729ef 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, | |||
774 | t->singleton = 1; | 774 | t->singleton = 1; |
775 | } | 775 | } |
776 | 776 | ||
777 | if (dm_target_always_writeable(tgt->type) && !(t->mode & FMODE_WRITE)) { | ||
778 | DMERR("%s: target type %s may not be included in read-only tables", | ||
779 | dm_device_name(t->md), type); | ||
780 | return -EINVAL; | ||
781 | } | ||
782 | |||
777 | tgt->table = t; | 783 | tgt->table = t; |
778 | tgt->begin = start; | 784 | tgt->begin = start; |
779 | tgt->len = len; | 785 | tgt->len = len; |