summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2006-06-17 22:48:34 +0000
committerrwatson <rwatson@FreeBSD.org>2006-06-17 22:48:34 +0000
commita1677cd65490dc2dd3c35b441958968477f1181b (patch)
treeb5105f3d5dc063a772657e2b7eebc5923364ee33
parentd9c30e05f502dcfd004e5fb113481e298cca349a (diff)
downloadFreeBSD-src-a1677cd65490dc2dd3c35b441958968477f1181b.zip
FreeBSD-src-a1677cd65490dc2dd3c35b441958968477f1181b.tar.gz
Remove sbinsertoob(), sbinsertoob_locked(). They violate (and have
basically always violated) invariannts of soreceive(), which assume that the first mbuf pointer in a receive socket buffer can't change while the SB_LOCK sleepable lock is held on the socket buffer, which is precisely what these functions do. No current protocols invoke these functions, and removing them will help discourage them from ever being used. I should have removed them years ago, but lost track of it. MFC after: 1 week Prodded almost by accident by: peter
-rw-r--r--sys/kern/uipc_sockbuf.c64
-rw-r--r--sys/kern/uipc_socket2.c64
-rw-r--r--sys/sys/socketvar.h2
3 files changed, 0 insertions, 130 deletions
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index a39c685..de44554 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -757,70 +757,6 @@ sbappendrecord(sb, m0)
}
/*
- * As above except that OOB data
- * is inserted at the beginning of the sockbuf,
- * but after any other OOB data.
- */
-void
-sbinsertoob_locked(sb, m0)
- register struct sockbuf *sb;
- register struct mbuf *m0;
-{
- register struct mbuf *m;
- register struct mbuf **mp;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- if (m0 == 0)
- return;
- for (mp = &sb->sb_mb; *mp ; mp = &((*mp)->m_nextpkt)) {
- m = *mp;
- again:
- switch (m->m_type) {
-
- case MT_OOBDATA:
- continue; /* WANT next train */
-
- case MT_CONTROL:
- m = m->m_next;
- if (m)
- goto again; /* inspect THIS train further */
- }
- break;
- }
- /*
- * Put the first mbuf on the queue.
- * Note this permits zero length records.
- */
- sballoc(sb, m0);
- m0->m_nextpkt = *mp;
- *mp = m0;
- m = m0->m_next;
- m0->m_next = 0;
- if (m && (m0->m_flags & M_EOR)) {
- m0->m_flags &= ~M_EOR;
- m->m_flags |= M_EOR;
- }
- sbcompress(sb, m, m0);
-}
-
-/*
- * As above except that OOB data
- * is inserted at the beginning of the sockbuf,
- * but after any other OOB data.
- */
-void
-sbinsertoob(sb, m0)
- register struct sockbuf *sb;
- register struct mbuf *m0;
-{
-
- SOCKBUF_LOCK(sb);
- sbinsertoob_locked(sb, m0);
- SOCKBUF_UNLOCK(sb);
-}
-
-/*
* Append address and data, and optionally, control (ancillary) data
* to the receive queue of a socket. If present,
* m0 must include a packet header with total length.
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index a39c685..de44554 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -757,70 +757,6 @@ sbappendrecord(sb, m0)
}
/*
- * As above except that OOB data
- * is inserted at the beginning of the sockbuf,
- * but after any other OOB data.
- */
-void
-sbinsertoob_locked(sb, m0)
- register struct sockbuf *sb;
- register struct mbuf *m0;
-{
- register struct mbuf *m;
- register struct mbuf **mp;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- if (m0 == 0)
- return;
- for (mp = &sb->sb_mb; *mp ; mp = &((*mp)->m_nextpkt)) {
- m = *mp;
- again:
- switch (m->m_type) {
-
- case MT_OOBDATA:
- continue; /* WANT next train */
-
- case MT_CONTROL:
- m = m->m_next;
- if (m)
- goto again; /* inspect THIS train further */
- }
- break;
- }
- /*
- * Put the first mbuf on the queue.
- * Note this permits zero length records.
- */
- sballoc(sb, m0);
- m0->m_nextpkt = *mp;
- *mp = m0;
- m = m0->m_next;
- m0->m_next = 0;
- if (m && (m0->m_flags & M_EOR)) {
- m0->m_flags &= ~M_EOR;
- m->m_flags |= M_EOR;
- }
- sbcompress(sb, m, m0);
-}
-
-/*
- * As above except that OOB data
- * is inserted at the beginning of the sockbuf,
- * but after any other OOB data.
- */
-void
-sbinsertoob(sb, m0)
- register struct sockbuf *sb;
- register struct mbuf *m0;
-{
-
- SOCKBUF_LOCK(sb);
- sbinsertoob_locked(sb, m0);
- SOCKBUF_UNLOCK(sb);
-}
-
-/*
* Append address and data, and optionally, control (ancillary) data
* to the receive queue of a socket. If present,
* m0 must include a packet header with total length.
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index 5e4cd5a..40f1766 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -483,8 +483,6 @@ void sbdroprecord(struct sockbuf *sb);
void sbdroprecord_locked(struct sockbuf *sb);
void sbflush(struct sockbuf *sb);
void sbflush_locked(struct sockbuf *sb);
-void sbinsertoob(struct sockbuf *sb, struct mbuf *m0);
-void sbinsertoob_locked(struct sockbuf *sb, struct mbuf *m0);
void sbrelease(struct sockbuf *sb, struct socket *so);
void sbrelease_locked(struct sockbuf *sb, struct socket *so);
int sbreserve(struct sockbuf *sb, u_long cc, struct socket *so,
OpenPOWER on IntegriCloud