From 10487ea1816d78384f0be0a50341b4c6d9bf88e3 Mon Sep 17 00:00:00 2001 From: jch Date: Mon, 12 Nov 2018 17:57:12 +0000 Subject: [PATCH] cxgbe/netmap: Fix cxgbe netmap when interface is DOWN A kernel panic can occur if the cxgbe interface is DOWN when activating netmap. This patch prevents the driver from freeing up cxgbe netmap resources when they have not been allocated. Submitted by: Nicolas Witkowski Reviewed by: np MFC after: 1 week Sponsored by: Verisign, Inc. Differential Revision: https://reviews.freebsd.org/D17802 --- sys/dev/cxgbe/t4_netmap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index adcd82034277..a27d54ec07f6 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -492,6 +492,9 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, ASSERT_SYNCHRONIZED_OP(sc); + if (!nm_netmap_on(na)) + return (0); + if ((vi->flags & VI_INIT_DONE) == 0) return (0);