summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2015-01-26 16:26:28 +0000
committerjhb <jhb@FreeBSD.org>2015-01-26 16:26:28 +0000
commitc5ac2eb628656fbcba77f3ea79ce6a10cce4a299 (patch)
treecb1d8d8b04fa0b79e82cdb263f07cde4bf2f1f01
parentbd34e367bbf0be832245c751c973aa915890dcfd (diff)
downloadFreeBSD-src-c5ac2eb628656fbcba77f3ea79ce6a10cce4a299.zip
FreeBSD-src-c5ac2eb628656fbcba77f3ea79ce6a10cce4a299.tar.gz
Fix a couple of panics when detaching from a cxgbe/cxl interface that was
never brought up: - Allow NULL to be passed to sglist_free(). - Don't try to stop an interface that was never fully initialized. Reviewed by: np
-rw-r--r--sys/dev/cxgbe/t4_main.c6
-rw-r--r--sys/kern/subr_sglist.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index dbd6334..7f59e84 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -3292,6 +3292,12 @@ cxgbe_uninit_synchronized(struct port_info *pi)
ASSERT_SYNCHRONIZED_OP(sc);
+ if (!(pi->flags & PORT_INIT_DONE)) {
+ KASSERT(!(ifp->if_drv_flags & IFF_DRV_RUNNING),
+ ("uninited port is running"));
+ return (0);
+ }
+
/*
* Disable the VI so that all its data in either direction is discarded
* by the MPS. Leave everything else (the queues, interrupts, and 1Hz
diff --git a/sys/kern/subr_sglist.c b/sys/kern/subr_sglist.c
index c66973a..df88a26 100644
--- a/sys/kern/subr_sglist.c
+++ b/sys/kern/subr_sglist.c
@@ -216,6 +216,9 @@ void
sglist_free(struct sglist *sg)
{
+ if (sg == NULL)
+ return;
+
if (refcount_release(&sg->sg_refs))
free(sg, M_SGLIST);
}
OpenPOWER on IntegriCloud