DragonFlyBSD Kernel Audit
DF-0710 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/netbt/sco_socket.c b/sys/netbt/sco_socket.c
--- a/sys/netbt/sco_socket.c
+++ b/sys/netbt/sco_socket.c
@@ -214,12 +214,17 @@
 
 	/*
 	 * since this data is time sensitive, if the buffer
-	 * is full we just dump data until the latest one
-	 * will fit.
+	 * is full we drop the packet. (Cannot evict records to
+	 * make room: a single packet larger than so_rcv hiwat
+	 * would never fit, causing an unbounded loop -- see l2cap/rfcomm.)
 	 */
 
-	while (m->m_pkthdr.len > sbspace(&so->so_rcv))
-		sbdroprecord(&so->so_rcv.sb);
+	if (m->m_pkthdr.len > sbspace(&so->so_rcv)) {
+		DPRINTF("%s: packet (%d bytes) dropped (socket buffer full)\n",
+			__func__, m->m_pkthdr.len);
+		m_freem(m);
+		return;
+	}
 
 	DPRINTFN(10, "received %d bytes\n", m->m_pkthdr.len);