diff options
author | Alasdair Kergon <agk@redhat.com> | 2013-08-29 17:37:45 +0200 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2013-09-06 02:46:06 +0200 |
commit | c2b04824620f30b52bb2fdcdd14c758b8c62c70f (patch) | |
tree | 5a6c619a3f7fe93c074c437c5e7a9bb23fcecbe2 /drivers/md/dm-ioctl.c | |
parent | dm thin: set pool read-only if breaking_sharing fails block allocation (diff) | |
download | linux-c2b04824620f30b52bb2fdcdd14c758b8c62c70f.tar.xz linux-c2b04824620f30b52bb2fdcdd14c758b8c62c70f.zip |
dm ioctl: prevent rename to empty name or uuid
A device-mapper device must always have a name consisting of a non-empty
string. If the device also has a uuid, this similarly must not be an
empty string.
The DM_DEV_CREATE ioctl enforces these rules when the device is created,
but this patch is needed to enforce them when DM_DEV_RENAME is used to
change the name or uuid.
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Mikulas Patocka <mpatocka@redhat.com>
Diffstat (limited to 'drivers/md/dm-ioctl.c')
-rw-r--r-- | drivers/md/dm-ioctl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index f1b758675ec7..5667cea55e71 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -877,7 +877,7 @@ static int dev_rename(struct dm_ioctl *param, size_t param_size) unsigned change_uuid = (param->flags & DM_UUID_FLAG) ? 1 : 0; if (new_data < param->data || - invalid_str(new_data, (void *) param + param_size) || + invalid_str(new_data, (void *) param + param_size) || !*new_data || strlen(new_data) > (change_uuid ? DM_UUID_LEN - 1 : DM_NAME_LEN - 1)) { DMWARN("Invalid new mapped device name or uuid string supplied."); return -EINVAL; |