diff options
author | Milan Broz <mbroz@redhat.com> | 2009-03-16 16:56:01 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-23 15:00:00 -0700 |
commit | e6e775fcaef2b0d5cb50dbc709bfa7f07762c3a6 (patch) | |
tree | 9df60a0270ede0cc1252d06338c58da11f5cc89a /drivers | |
parent | e2c0fa5344dff02dcb837114a8b7b79034d1b268 (diff) | |
download | lwn-e6e775fcaef2b0d5cb50dbc709bfa7f07762c3a6.tar.gz lwn-e6e775fcaef2b0d5cb50dbc709bfa7f07762c3a6.zip |
dm ioctl: validate name length when renaming
commit bc0fd67feba2e0770aad85393500ba77c6489f1c upstream.
When renaming a mapped device validate the length of the new name.
The rename ioctl accepted any correctly-terminated string enclosed
within the data passed from userspace. The other ioctls enforce a
size limit of DM_NAME_LEN. If the name is changed and becomes longer
than that, the device can no longer be addressed by name.
Fix it by properly checking for device name length (including
terminating zero).
Signed-off-by: Milan Broz <mbroz@redhat.com>
Reviewed-by: Jonathan Brassow <jbrassow@redhat.com>
Reviewed-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-ioctl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index b262c0042de3..b8ab11fe8f96 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -704,7 +704,8 @@ static int dev_rename(struct dm_ioctl *param, size_t param_size) char *new_name = (char *) param + param->data_start; if (new_name < param->data || - invalid_str(new_name, (void *) param + param_size)) { + invalid_str(new_name, (void *) param + param_size) || + strlen(new_name) > DM_NAME_LEN - 1) { DMWARN("Invalid new logical volume name supplied."); return -EINVAL; } |