dm ioctl: validate name length when renaming
Alasdair G Kergon
maintainerPATCH 1/1 dm ioctl: validate name length when renaming
From: Milan Broz <[email protected]>
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).
--- drivers/md/dm-ioctl.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-)
drivers/md/dm-ioctl.c +2 -1
@@ -704,7 +704,8 @@ static int dev_rename(struct dm_ioctl *pchar *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 ; }
Quoted 2 lines · Alasdair G Kergon
From: Milan Broz <[email protected]>
When renaming a mapped device validate the length of the new name.
Alasdair
Signature · 1 line
[email protected]
Quoted 2 lines · Alasdair G Kergon
From: Milan Broz <[email protected]>
When renaming a mapped device validate the length of the new name.
Alasdair
Signature · 1 line
[email protected]
Quoted 2 lines · Alasdair G Kergon
From: Milan Broz <[email protected]>
When renaming a mapped device validate the length of the new name.
Well I haven't actually tested this patch, but I'm testing patchwork...
Alasdair
Signature · 1 line
[email protected]
brassow
Quoted 40 lines · Alasdair G Kergon
From: Milan Broz <[email protected]>
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 <[email protected]>Signed-off-by Alasdair G Kergon <[email protected]>---
drivers/md/dm-ioctl.c| 3 ++-1 files changed, 2 insertions(+), 1 deletion(-)Index:
linux-2.6.28/drivers/md/dm-ioctl.c
===================================================================
---linux-2.6.28.orig/drivers/md/dm-ioctl.c2009-01-06
15:06:06.000000000 +0000
+++linux-2.6.28/drivers/md/dm-ioctl.c2009-01-06 15:07:04.000000000
+0000drivers/md/dm-ioctl.c +2
-2@@ -704,7 +704,8 @@ static int dev_rename(struct dm_ioctl *pchar *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 ; } --dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel