[NTOS:IO]

- Fix potential null-pointer dereferencing (we call IopCleanupAfterException in IopDeviceFsIoControl with Irp == NULL)

svn path=/trunk/; revision=72548
This commit is contained in:
Dmitry Chapyshev 2016-09-03 15:49:55 +00:00
parent 6c6813d7f7
commit 212b70142c

View file

@ -22,26 +22,29 @@
VOID VOID
NTAPI NTAPI
IopCleanupAfterException(IN PFILE_OBJECT FileObject, IopCleanupAfterException(IN PFILE_OBJECT FileObject,
IN PIRP Irp, IN PIRP Irp OPTIONAL,
IN PKEVENT Event OPTIONAL, IN PKEVENT Event OPTIONAL,
IN PKEVENT LocalEvent OPTIONAL) IN PKEVENT LocalEvent OPTIONAL)
{ {
PAGED_CODE(); PAGED_CODE();
IOTRACE(IO_API_DEBUG, "IRP: %p. FO: %p \n", Irp, FileObject); IOTRACE(IO_API_DEBUG, "IRP: %p. FO: %p \n", Irp, FileObject);
/* Check if we had a buffer */ if (Irp)
if (Irp->AssociatedIrp.SystemBuffer)
{ {
/* Free it */ /* Check if we had a buffer */
ExFreePool(Irp->AssociatedIrp.SystemBuffer); if (Irp->AssociatedIrp.SystemBuffer)
{
/* Free it */
ExFreePool(Irp->AssociatedIrp.SystemBuffer);
}
/* Free the mdl */
if (Irp->MdlAddress) IoFreeMdl(Irp->MdlAddress);
/* Free the IRP */
IoFreeIrp(Irp);
} }
/* Free the mdl */
if (Irp->MdlAddress) IoFreeMdl(Irp->MdlAddress);
/* Free the IRP */
IoFreeIrp(Irp);
/* Check if we had a file lock */ /* Check if we had a file lock */
if (FileObject->Flags & FO_SYNCHRONOUS_IO) if (FileObject->Flags & FO_SYNCHRONOUS_IO)
{ {