summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornp <np@FreeBSD.org>2016-03-20 05:01:40 +0000
committernp <np@FreeBSD.org>2016-03-20 05:01:40 +0000
commitf123f2ce18da0576fdc172a9998986f0057ad704 (patch)
tree94c4bb5df3b3d377a901b081055dd7429c8f6a96
parentf36ffd2dd3da7f7cfa11d1c86438a9bafd0076e9 (diff)
downloadFreeBSD-src-f123f2ce18da0576fdc172a9998986f0057ad704.zip
FreeBSD-src-f123f2ce18da0576fdc172a9998986f0057ad704.tar.gz
MFC r277759 (by jhb@)
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. PR: 208136
-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 de4a380..3dfb53f 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -3250,6 +3250,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