mirror of
				https://github.com/winfsp/winfsp.git
				synced 2025-10-29 19:18:39 -05:00 
			
		
		
		
	sys: Reference the virtual volume device so that it will not go away while the file system device object is alive
This commit is contained in:
		| @@ -204,6 +204,14 @@ static NTSTATUS FspFsvolDeviceInit(PDEVICE_OBJECT DeviceObject) | |||||||
| static VOID FspFsvolDeviceFini(PDEVICE_OBJECT DeviceObject) | static VOID FspFsvolDeviceFini(PDEVICE_OBJECT DeviceObject) | ||||||
| { | { | ||||||
|     PAGED_CODE(); |     PAGED_CODE(); | ||||||
|  |  | ||||||
|  |     FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension = FspFsvolDeviceExtension(DeviceObject); | ||||||
|  |  | ||||||
|  |     /* | ||||||
|  |      * Dereference the virtual volume device so that it can now go away. | ||||||
|  |      */ | ||||||
|  |     if (0 != FsvolDeviceExtension->FsvrtDeviceObject) | ||||||
|  |         ObDereferenceObject(FsvolDeviceExtension->FsvrtDeviceObject); | ||||||
| } | } | ||||||
|  |  | ||||||
| BOOLEAN FspDeviceRetain(PDEVICE_OBJECT DeviceObject) | BOOLEAN FspDeviceRetain(PDEVICE_OBJECT DeviceObject) | ||||||
|   | |||||||
| @@ -230,6 +230,12 @@ static NTSTATUS FspFsctlMountVolume( | |||||||
|             &FsvolDeviceObject); |             &FsvolDeviceObject); | ||||||
|         if (NT_SUCCESS(Result)) |         if (NT_SUCCESS(Result)) | ||||||
|         { |         { | ||||||
|  |             /* | ||||||
|  |              * Reference the virtual volume device so that it will not go away while the | ||||||
|  |              * file system device object is alive! | ||||||
|  |              */ | ||||||
|  |             ObReferenceObject(FsvrtDeviceObject); | ||||||
|  |  | ||||||
| #pragma prefast(suppress:28175, "We are a filesystem: ok to access SectorSize") | #pragma prefast(suppress:28175, "We are a filesystem: ok to access SectorSize") | ||||||
|             FsvolDeviceObject->SectorSize = FsvrtDeviceExtension->VolumeParams.SectorSize; |             FsvolDeviceObject->SectorSize = FsvrtDeviceExtension->VolumeParams.SectorSize; | ||||||
|             FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject); |             FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user