Skip to content

Commit 7ad48c0

Browse files
hideyukn88chessturo
authored andcommitted
drivers: hv: dxgkrnl: Fix crash at hmgrtable_free_handle
1 parent 7ea2c71 commit 7ad48c0

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/hv/dxgkrnl/hmgr.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,14 @@ void hmgrtable_free_handle(struct hmgrtable *table, enum hmgrentry_type t,
462462
*/
463463
entry->next_free_index = HMGRTABLE_INVALID_INDEX;
464464
entry->prev_free_index = table->free_handle_list_tail;
465-
entry = &table->entry_table[table->free_handle_list_tail];
466-
entry->next_free_index = i;
465+
if (table->free_handle_list_tail != HMGRTABLE_INVALID_INDEX) {
466+
entry = &table->entry_table[table->free_handle_list_tail];
467+
entry->next_free_index = i;
468+
}
467469
table->free_handle_list_tail = i;
470+
if (table->free_handle_list_head == HMGRTABLE_INVALID_INDEX) {
471+
table->free_handle_list_head = i;
472+
}
468473
} else {
469474
DXG_ERR("Invalid handle to free: %d %x", i, h.v);
470475
}

0 commit comments

Comments
 (0)