Skip to content

Commit

Permalink
kern/intr: have intr_event_destroy() return success on NULL event
Browse files Browse the repository at this point in the history
A NULL event likely indicates the event was either already released or
never allocated.  In such case the event has already been cleaned up and
that is what the caller needs to know.  This gets called from cleanup
paths and cleanup should not be abandoned if the event is invalid.

Emit a warning message as this indicates inconsistent state.  There may
well simply be the precursor to a page-fault panic().

Differential Revision: https://reviews.freebsd.org/D38602
  • Loading branch information
ehem committed Dec 16, 2024
1 parent 8239e65 commit e5e19cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sys/kern/kern_intr.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,10 @@ int
intr_event_destroy(struct intr_event *ie)
{

if (ie == NULL)
return (EINVAL);
if (ie == NULL) {
printf("ERROR: %s(): passed NULL event!\n", __func__);
return (0);
}

mtx_lock(&event_lock);
mtx_lock(&ie->ie_lock);
Expand Down

0 comments on commit e5e19cf

Please sign in to comment.