Fork us on GitHub Follow us on Facebook Follow us on Twitter

Opened 10 years ago

Closed 10 years ago

#245 closed defect (fixed)

Forgotten error handling in vfs_open.

Reported by: Tomas Brambora Owned by:
Priority: major Milestone: 0.4.3
Component: helenos/srv/vfs Version: mainline
Keywords: Cc:
Blocker for: Depends on:
See also:

Description

In vfs_ops.c, function vfs_open there are this two statements:

vfs_file_t *file = vfs_file_get(fd);
file->node = node;

However, vfs_file_get can return NULL, in which case file→node causes VFS to crash.

Change History (2)

comment:1 Changed 10 years ago by Jakub Jermář

This problem appears to be only theoretical, because fd is allocated by vfs_fd_alloc() and we know it is a good fd (from the previous test). Moreover, vfs_fd_alloc(), had a chance to call vfs_files_init(). Now that fd is valid, vfs_files_init() must have already succeeded and thus vfs_fd_get() cannot return NULL.

comment:2 Changed 10 years ago by Jakub Jermář

Resolution: fixed
Status: newclosed

In changeset:head,509, I added an assertion which checks file is not NULL. Seeing NULL in file would be totally unexpected in this context.

Note: See TracTickets for help on using tickets.