Don't allow to create devices with '/' in names

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1815 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2010-07-13 12:11:52 +00:00
parent e8f6cfd143
commit 8437061902

View File

@@ -996,6 +996,20 @@ out:
return res;
}
static int scst_check_device_name(const char *dev_name)
{
int res = 0;
if (strchr(dev_name, '/') != NULL) {
PRINT_ERROR("Dev name %s contains illegal character '/'",
dev_name);
res = -EINVAL;
}
TRACE_EXIT_RES(res);
return res;
}
/**
* scst_register_virtual_device() - register a virtual device.
* @dev_handler: the device's device handler
@@ -1026,6 +1040,10 @@ int scst_register_virtual_device(struct scst_dev_type *dev_handler,
goto out;
}
res = scst_check_device_name(dev_name);
if (res != 0)
goto out;
res = scst_dev_handler_check(dev_handler);
if (res != 0)
goto out;