mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Fixed the dereferencing of an existing named object in IoCreateFile.
svn path=/trunk/; revision=14561
This commit is contained in:
parent
6256db0836
commit
02d3095664
1 changed files with 6 additions and 6 deletions
|
@ -344,8 +344,8 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||||
IN PVOID ExtraCreateParameters OPTIONAL,
|
IN PVOID ExtraCreateParameters OPTIONAL,
|
||||||
IN ULONG Options)
|
IN ULONG Options)
|
||||||
{
|
{
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject = NULL;
|
||||||
PDEVICE_OBJECT DeviceObject = NULL;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
PIO_STACK_LOCATION StackLoc;
|
PIO_STACK_LOCATION StackLoc;
|
||||||
IO_SECURITY_CONTEXT SecurityContext;
|
IO_SECURITY_CONTEXT SecurityContext;
|
||||||
|
@ -460,23 +460,23 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||||
AccessMode,
|
AccessMode,
|
||||||
(PVOID*)&DeviceObject,
|
(PVOID*)&DeviceObject,
|
||||||
NULL);
|
NULL);
|
||||||
ObDereferenceObject (DeviceObject);
|
ZwClose(LocalHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
if (BODY_TO_HEADER(DeviceObject)->ObjectType != IoDeviceObjectType)
|
if (BODY_TO_HEADER(DeviceObject)->ObjectType != IoDeviceObjectType)
|
||||||
{
|
{
|
||||||
ZwClose(LocalHandle);
|
ObDereferenceObject (DeviceObject);
|
||||||
return STATUS_OBJECT_NAME_COLLISION;
|
return STATUS_OBJECT_NAME_COLLISION;
|
||||||
}
|
}
|
||||||
FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
|
FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
|
||||||
ZwClose(LocalHandle);
|
ObDereferenceObject (DeviceObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (DeviceObject == NULL)
|
if (FileObject == NULL)
|
||||||
{
|
{
|
||||||
Status = ObCreateObject(AccessMode,
|
Status = ObCreateObject(AccessMode,
|
||||||
IoFileObjectType,
|
IoFileObjectType,
|
||||||
|
|
Loading…
Reference in a new issue