mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-22 05:01:27 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user