[general] Fixed crash in fs.h, when called with fsdrv.create == NULL
When a nor0 devices has no partitions assigned, then a call to open() to create a file will jump with a NULL fct ptr. Much more cheching code is missing and pointers to function are jumped without any NULL ptr check. This must be fixed as well later. Signed-off-by: Carsten Schlote <c.schlote@konzeptpark.de>
This commit is contained in:
parent
7f266db949
commit
c1bba7e226
7
fs/fs.c
7
fs/fs.c
|
@ -406,8 +406,11 @@ int open(const char *pathname, int flags, ...)
|
|||
}
|
||||
|
||||
if (!exist) {
|
||||
errno = fsdrv->create(dev, path,
|
||||
S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
if (NULL != fsdrv->create)
|
||||
errno = fsdrv->create(dev, path,
|
||||
S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
else
|
||||
errno = -EROFS;
|
||||
if (errno)
|
||||
goto out;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue