mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-20 04:01:26 +00:00
Enforce max LUNs limitation
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2490 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -46,6 +46,9 @@
|
||||
/* Max size of external names, like initiator name */
|
||||
#define SCST_MAX_EXTERNAL_NAME 256
|
||||
|
||||
/* Max LUN. 2 bits are used for addressing method. */
|
||||
#define SCST_MAX_LUN ((1 << (16-2)) - 1)
|
||||
|
||||
/*
|
||||
* Size of sense sufficient to carry standard sense data.
|
||||
* Warning! It's allocated on stack!
|
||||
|
||||
@@ -2007,7 +2007,14 @@ static ssize_t scst_proc_groups_devices_write(struct file *file,
|
||||
e++;
|
||||
while (isspace(*e) && *e != '\0')
|
||||
e++;
|
||||
|
||||
virt_lun = simple_strtoul(e, &e, 0);
|
||||
if (virt_lun > SCST_MAX_LUN) {
|
||||
PRINT_ERROR("Too big LUN %d (max %d)", virt_lun,
|
||||
SCST_MAX_LUN);
|
||||
res = -EINVAL;
|
||||
goto out_free_up;
|
||||
}
|
||||
|
||||
while (isspace(*e) && *e != '\0')
|
||||
e++;
|
||||
|
||||
@@ -2720,7 +2720,14 @@ static int __scst_process_luns_mgmt_store(char *buffer,
|
||||
e++;
|
||||
while (isspace(*e) && *e != '\0')
|
||||
e++;
|
||||
|
||||
virt_lun = simple_strtoul(e, &e, 0);
|
||||
if (virt_lun > SCST_MAX_LUN) {
|
||||
PRINT_ERROR("Too big LUN %d (max %d)", virt_lun,
|
||||
SCST_MAX_LUN);
|
||||
res = -EINVAL;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
while (isspace(*e) && *e != '\0')
|
||||
e++;
|
||||
|
||||
Reference in New Issue
Block a user