Skip to content

Commit

Permalink
Check for NULL parent in error cases
Browse files Browse the repository at this point in the history
Signed-off-by: Jorgen Lundman <[email protected]>
  • Loading branch information
lundman committed Dec 15, 2023
1 parent 2ac0ef0 commit cfea119
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions module/os/windows/zfs/zfs_vnops_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,8 @@ zfs_vnop_lookup_impl(PIRP Irp, PIO_STACK_LOCATION IrpSp, mount_t *zmo,
// Fail if FILE_CREATE but target exist
if ((CreateDisposition == FILE_CREATE) && (vp != NULL)) {
VN_RELE(vp);
VN_RELE(dvp);
if (dvp)
VN_RELE(dvp);
Irp->IoStatus.Information = FILE_EXISTS;
if (CreateDirectory && !vnode_isdir(vp))
return (STATUS_NOT_A_DIRECTORY);
Expand Down Expand Up @@ -1361,15 +1362,17 @@ zfs_vnop_lookup_impl(PIRP Irp, PIO_STACK_LOCATION IrpSp, mount_t *zmo,
if (DirectoryFile && vp != NULL && !vnode_isdir(vp)) {
dprintf("%s: asked for directory but found file\n", __func__);
VN_RELE(vp);
VN_RELE(dvp);
if (dvp)
VN_RELE(dvp);
Irp->IoStatus.Information = FILE_DOES_NOT_EXIST;
return (STATUS_FILE_IS_A_DIRECTORY);
}

// Asked for non-directory, but we got directory
if (NonDirectoryFile && !CreateFile && vp == NULL) {
dprintf("%s: asked for file but found directory\n", __func__);
VN_RELE(dvp);
if (dvp)
VN_RELE(dvp);
Irp->IoStatus.Information = FILE_DOES_NOT_EXIST;
return (STATUS_FILE_IS_A_DIRECTORY);
}
Expand All @@ -1391,7 +1394,8 @@ zfs_vnop_lookup_impl(PIRP Irp, PIO_STACK_LOCATION IrpSp, mount_t *zmo,
!FlagOn(IrpSp->Parameters.Create.FileAttributes,
FILE_ATTRIBUTE_SYSTEM))) {
VN_RELE(vp);
VN_RELE(dvp);
if (dvp)
VN_RELE(dvp);
dprintf("%s: denied due to hidden+system combo\n",
__func__);
return (STATUS_ACCESS_DENIED);
Expand Down

0 comments on commit cfea119

Please sign in to comment.