Module Name: src Committed By: isaki Date: Sat Mar 9 11:16:31 UTC 2024
Modified Files: src/sys/arch/virt68k/dev: virtio_mainbus.c Log Message: Fix a null dereference. free_interrupts may be called even when sc_ih has not been assigned yet. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/dev/virtio_mainbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/virt68k/dev/virtio_mainbus.c diff -u src/sys/arch/virt68k/dev/virtio_mainbus.c:1.1 src/sys/arch/virt68k/dev/virtio_mainbus.c:1.2 --- src/sys/arch/virt68k/dev/virtio_mainbus.c:1.1 Tue Jan 2 07:40:59 2024 +++ src/sys/arch/virt68k/dev/virtio_mainbus.c Sat Mar 9 11:16:31 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: virtio_mainbus.c,v 1.1 2024/01/02 07:40:59 thorpej Exp $ */ +/* $NetBSD: virtio_mainbus.c,v 1.2 2024/03/09 11:16:31 isaki Exp $ */ /* * Copyright (c) 2021, 2024 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: virtio_mainbus.c,v 1.1 2024/01/02 07:40:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: virtio_mainbus.c,v 1.2 2024/03/09 11:16:31 isaki Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -170,6 +170,8 @@ virtio_mainbus_alloc_interrupts(struct v static void virtio_mainbus_free_interrupts(struct virtio_mmio_softc *msc) { - intr_disestablish(msc->sc_ih); - msc->sc_ih = NULL; + if (msc->sc_ih) { + intr_disestablish(msc->sc_ih); + msc->sc_ih = NULL; + } }