mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
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
This commit is contained in:
parent
5ce609a3e1
commit
cd3a3a269f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159706
@ -756,70 +756,6 @@ sbappendrecord(sb, m0)
|
||||
SOCKBUF_UNLOCK(sb);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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,
|
||||
|
@ -756,70 +756,6 @@ sbappendrecord(sb, m0)
|
||||
SOCKBUF_UNLOCK(sb);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user