Module: wine Branch: master Commit: 5f76f07bff03dc80453cf742be1fe23781c12d92 URL: https://gitlab.winehq.org/wine/wine/-/commit/5f76f07bff03dc80453cf742be1fe23...
Author: Elizabeth Figura zfigura@codeweavers.com Date: Fri Jun 24 20:36:30 2022 -0500
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.
---
dlls/ntdll/unix/cdrom.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/dlls/ntdll/unix/cdrom.c b/dlls/ntdll/unix/cdrom.c index 45b61d54d05..427e559968f 100644 --- a/dlls/ntdll/unix/cdrom.c +++ b/dlls/ntdll/unix/cdrom.c @@ -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; }