git: f177e00aefa4 - stable/13 - kern_intr: Check for NULL event in intr_destroy()

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Mon, 24 Oct 2022 15:54:14 UTC
The branch stable/13 has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=f177e00aefa49df572914fc061dd191e1b6e25f3

commit f177e00aefa49df572914fc061dd191e1b6e25f3
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-10-15 18:43:53 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-10-24 15:53:11 +0000

    kern_intr: Check for NULL event in intr_destroy()
    
    It likely won't happen, but is consistent with the other functions of
    this KPI.
    
    Reviewed by:    imp, jhb
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D33479
    
    (cherry picked from commit 39888ed7a3dca81c5d5c886e699dbcf58953137f)
---
 sys/kern/kern_intr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c
index 449ae224bbe0..29e88ff42ae4 100644
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -505,6 +505,9 @@ int
 intr_event_destroy(struct intr_event *ie)
 {
 
+	if (ie == NULL)
+		return (EINVAL);
+
 	mtx_lock(&event_lock);
 	mtx_lock(&ie->ie_lock);
 	if (!CK_SLIST_EMPTY(&ie->ie_handlers)) {