kernel/fs: Account for vnode being NULL in vfs_release_posix_lock.

When the FD is put() but not freed while O_DISCONNECTED, its "ops"
and "vnode" are cleared. Thus it is entirely valid for a non-NULL
file FD to have a NULL vnode, so we should just treat such FDs
as if the locks had already been cleared (which they should have.)

Fixes #14294.
This commit is contained in:
Augustin Cavalier 2018-12-12 19:24:59 -05:00
parent bee962a25e
commit e7e7a55250

View File

@ -4891,6 +4891,8 @@ status_t
vfs_release_posix_lock(io_context* context, struct file_descriptor* descriptor)
{
struct vnode* vnode = descriptor->u.vnode;
if (vnode == NULL)
return B_OK;
if (HAS_FS_CALL(vnode, release_lock))
return FS_CALL(vnode, release_lock, descriptor->cookie, NULL);