ntdll: Do not fill the IOSB or signal completion on failure in cdrom_DeviceIoControl().

Synchronous NT_ERROR conditions should not touch the IOSB or signal completion.
This commit is contained in:
Elizabeth Figura 2022-06-24 20:36:30 -05:00 committed by Alexandre Julliard
parent 0e928ccaea
commit 5f76f07bff

View file

@ -2822,18 +2822,13 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc
TRACE( "%p %s %p %d %p %d %p\n", device, iocodex(code), in_buffer, in_size, out_buffer, out_size, io );
io->Information = 0;
if ((status = server_get_unix_fd( device, 0, &fd, &needs_close, NULL, NULL )))
{
if (status == STATUS_BAD_DEVICE_TYPE) return status; /* no associated fd */
goto error;
}
return status;
if ((status = CDROM_Open(fd, &dev)))
{
if (needs_close) close( fd );
goto error;
return status;
}
#ifdef __APPLE__
@ -2847,16 +2842,13 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc
* Also for some reason it wants the fd to be closed before we even
* open the parent if we're trying to eject the disk.
*/
if ((status = get_parent_device( fd, name, sizeof(name) ))) goto error;
if ((status = get_parent_device( fd, name, sizeof(name) ))) return status;
if (code == IOCTL_STORAGE_EJECT_MEDIA)
NtClose( device );
if (needs_close) close( fd );
TRACE("opening parent %s\n", name );
if ((fd = open( name, O_RDONLY )) == -1)
{
status = errno_to_status( errno );
goto error;
}
return errno_to_status( errno );
needs_close = 1;
}
#endif
@ -3117,13 +3109,14 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc
break;
default:
if (needs_close) close( fd );
return STATUS_NOT_SUPPORTED;
status = STATUS_NOT_SUPPORTED;
}
if (needs_close) close( fd );
error:
io->Status = status;
io->Information = sz;
if (event) NtSetEvent(event, NULL);
if (!NT_ERROR(status))
{
io->Status = status;
io->Information = sz;
if (event) NtSetEvent(event, NULL);
}
return status;
}