Skip to content

Commit 411a917

Browse files
author
Iouri Tarassov
committed
drivers: hv: dxgkrnl: Added missed NULL check for resource object
Signed-off-by: Iouri Tarassov <[email protected]>
1 parent 54194c4 commit 411a917

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/hv/dxgkrnl/ioctl.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,8 @@ dxgkio_create_allocation(struct dxgprocess *process, void *__user inargs)
15891589
&process->handle_table,
15901590
HMGRENTRY_TYPE_DXGRESOURCE,
15911591
args.resource);
1592-
kref_get(&resource->resource_kref);
1592+
if (resource != NULL)
1593+
kref_get(&resource->resource_kref);
15931594
dxgprocess_ht_lock_shared_up(process);
15941595

15951596
if (resource == NULL || resource->device != device) {
@@ -1693,10 +1694,8 @@ dxgkio_create_allocation(struct dxgprocess *process, void *__user inargs)
16931694
&standard_alloc);
16941695
cleanup:
16951696

1696-
if (resource_mutex_acquired) {
1697+
if (resource_mutex_acquired)
16971698
mutex_unlock(&resource->resource_mutex);
1698-
kref_put(&resource->resource_kref, dxgresource_release);
1699-
}
17001699
if (ret < 0) {
17011700
if (dxgalloc) {
17021701
for (i = 0; i < args.alloc_count; i++) {
@@ -1727,6 +1726,9 @@ dxgkio_create_allocation(struct dxgprocess *process, void *__user inargs)
17271726
if (adapter)
17281727
dxgadapter_release_lock_shared(adapter);
17291728

1729+
if (resource && !args.flags.create_resource)
1730+
kref_put(&resource->resource_kref, dxgresource_release);
1731+
17301732
if (device) {
17311733
dxgdevice_release_lock_shared(device);
17321734
kref_put(&device->device_kref, dxgdevice_release);

0 commit comments

Comments
 (0)