kernel: Store "next" pointer before notifying B_EVENT_INVALID.

Once B_EVENT_INVALID has been set, the select routine is free to
delete the select_info at any time. We therefore cannot access
the "next" pointer after notify_select_events returns.

May fix a KDL seen by trungnt2910.
This commit is contained in:
Augustin Cavalier 2023-08-04 13:53:58 -04:00
parent d8365e0f0f
commit 2d43eebcab
3 changed files with 6 additions and 3 deletions

View File

@ -745,8 +745,9 @@ notify_select_events_list(select_info* list, uint16 events)
{
struct select_info* info = list;
while (info != NULL) {
select_info* next = info->next;
notify_select_events(info, events);
info = info->next;
info = next;
}
}

View File

@ -556,8 +556,9 @@ deselect_select_infos(file_descriptor* descriptor, select_info* infos,
}
}
select_info* next = info->next;
notify_select_events(info, B_EVENT_INVALID);
info = info->next;
info = next;
if (putSyncObjects)
put_select_sync(sync);

View File

@ -2242,9 +2242,10 @@ thread_exit(void)
while (info != NULL) {
select_sync* sync = info->sync;
select_info* next = info->next;
notify_select_events(info, B_EVENT_INVALID);
info = info->next;
put_select_sync(sync);
info = next;
}
// notify listeners