git: 39888ed7a3dc - main - kern_intr: Check for NULL event in intr_destroy()

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Sat, 15 Oct 2022 18:52:10 UTC
The branch main has been updated by mhorne:

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

commit 39888ed7a3dca81c5d5c886e699dbcf58953137f
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-10-15 18:43:53 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-10-15 18:51:44 +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
---
 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 bcd5dc82864e..2d44e657b7f0 100644
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -532,6 +532,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)) {