diff options
author | dzwdz | 2024-05-11 20:41:00 +0200 |
---|---|---|
committer | dzwdz | 2024-05-11 20:41:00 +0200 |
commit | e4ebea27b2f339706da76a3e79cb63ea9ed97c38 (patch) | |
tree | 4cb8e90a512fd68c0e0412dc8da58ec7f312e026 /src/kernel/vfs | |
parent | 9047f1e3f502658de12808015179ab3881a4b03f (diff) |
kernel: fix null dereference when delegating an nonexistent handle
Diffstat (limited to 'src/kernel/vfs')
-rw-r--r-- | src/kernel/vfs/request.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index 0c763b3..e3f0316 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -60,9 +60,10 @@ void vfsreq_finish(VfsReq *req, char __user *stored, long ret, /* delegating - moving a handle to the caller */ assert(handler); h = hs_take(handler->hs, ret); - // TODO!!! no null check - h->readable = h->readable && OPEN_READABLE(req->flags); - h->writeable = h->writeable && OPEN_WRITEABLE(req->flags); + if (h) { + h->readable = h->readable && OPEN_READABLE(req->flags); + h->writeable = h->writeable && OPEN_WRITEABLE(req->flags); + } } if (h) { |