Module: wine Branch: master Commit: a77a1a543373826f92964359a788a8a2f6fa2bd5 URL: https://source.winehq.org/git/wine.git/?a=commit;h=a77a1a543373826f92964359a...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Apr 25 14:54:58 2019 +0200
server: Ensure that IRP_MJ_CLOSE is queued only once.
Client may alloc new handle inside IRP_MJ_CLOSE handler.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
server/device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/server/device.c b/server/device.c index 0bb2757..7037a2c 100644 --- a/server/device.c +++ b/server/device.c @@ -171,6 +171,7 @@ struct device_file struct device *device; /* device for this file */ struct fd *fd; /* file descriptor for irp */ client_ptr_t user_ptr; /* opaque ptr for client side */ + int closed; /* closed file flag */ struct list entry; /* entry in device list */ struct list requests; /* list of pending irp requests */ }; @@ -430,6 +431,7 @@ static struct object *device_open_file( struct object *obj, unsigned int access, if (!(file = alloc_object( &device_file_ops ))) return NULL;
file->device = (struct device *)grab_object( device ); + file->closed = 0; file->user_ptr = 0; list_init( &file->requests ); list_add_tail( &device->files, &file->entry ); @@ -496,11 +498,12 @@ static int device_file_close_handle( struct object *obj, struct process *process { struct device_file *file = (struct device_file *)obj;
- if (file->device->manager && obj->handle_count == 1) /* last handle */ + if (!file->closed && file->device->manager && obj->handle_count == 1) /* last handle */ { struct irp_call *irp; irp_params_t params;
+ file->closed = 1; memset( ¶ms, 0, sizeof(params) ); params.close.major = IRP_MJ_CLOSE;