ramfs: fix UAF in ramfs_create
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
72cb81c45a
commit
b3fc520a18
1 changed files with 5 additions and 4 deletions
|
|
@ -14,7 +14,7 @@ static u64 inode_ticker = 1;
|
|||
|
||||
int ramfs_create(u64 flags, fs_t **out)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
fs_t *fs = kalloc(sizeof(fs_t), ALLOC_KERN);
|
||||
if (!fs) {
|
||||
ret = -ENOMEM;
|
||||
|
|
@ -47,6 +47,7 @@ int ramfs_create(u64 flags, fs_t **out)
|
|||
root->inode = root_inode;
|
||||
|
||||
*out = fs;
|
||||
return 0;
|
||||
|
||||
out_root_inode:
|
||||
dirent_free(root);
|
||||
|
|
|
|||
Loading…
Reference in a new issue