Rémi Bernon : winebus.sys: Read irp->IoStatus.Status before leaving the CS.

Alexandre Julliard julliard at winehq.org
Fri Aug 13 14:44:13 CDT 2021


Module: wine
Branch: master
Commit: 28f797ec8b90ab6baf7a322d2f83a1fd9f69a53d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=28f797ec8b90ab6baf7a322d2f83a1fd9f69a53d

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Fri Aug 13 09:46:12 2021 +0200

winebus.sys: Read irp->IoStatus.Status before leaving the CS.

Or we may have a race condition where a pending IRP may be completed
after we left the CS but before we read its status.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winebus.sys/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index 001f775e230..b7230cf2e33 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -982,9 +982,9 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
             break;
     }
 
+    status = irp->IoStatus.Status;
     LeaveCriticalSection(&ext->cs);
 
-    status = irp->IoStatus.Status;
     if (status != STATUS_PENDING) IoCompleteRequest(irp, IO_NO_INCREMENT);
     return status;
 }




More information about the wine-cvs mailing list