diff options
-rw-r--r-- | sys/fs/tmpfs.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/fs/tmpfs.c b/sys/fs/tmpfs.c index 21dd7b5..6ae1c38 100644 --- a/sys/fs/tmpfs.c +++ b/sys/fs/tmpfs.c @@ -318,6 +318,15 @@ tmpfs_read(struct vnode *vp, struct sio_txn *sio) return -EIO; } + /* + * The node data is only allocated during writes, if + * we read this file before a write was ever done to it, + * np->data will be NULL. We must handle this. + */ + if (np->data == NULL) { + return 0; + } + /* Is this even a regular file? */ if (np->type != VREG) { return -EISDIR; |