diff options
author | jhb <jhb@FreeBSD.org> | 2015-01-26 16:26:28 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2015-01-26 16:26:28 +0000 |
commit | c5ac2eb628656fbcba77f3ea79ce6a10cce4a299 (patch) | |
tree | cb1d8d8b04fa0b79e82cdb263f07cde4bf2f1f01 | |
parent | bd34e367bbf0be832245c751c973aa915890dcfd (diff) | |
download | FreeBSD-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.c | 6 | ||||
-rw-r--r-- | sys/kern/subr_sglist.c | 3 |
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); } |