DragonFlyBSD Kernel Audit
DF-0283 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c b/sys/netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c
--- a/sys/netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c
+++ b/sys/netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c
@@ -1955,9 +1955,12 @@
 
 	for (m = m0; m->m_next != NULL; m = m->m_next)
 		;
-	if (m->m_len <= 0)
-		panic("%s: Empty mbuf at the end of the chain, len=%d",
-			__func__, m->m_len);
+	if (m->m_len <= 0) {
+		NG_BTSOCKET_RFCOMM_ERR(
+"%s: Empty mbuf at the end of the chain, len=%d\n", __func__, m->m_len);
+		NG_FREE_M(m0);
+		return (EINVAL);
+	}
 
 	/*
 	 * Check FCS. We only need to calculate FCS on first 2 or 3 bytes