mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-25 11:37:56 +00:00
In both dropwithreset paths in tcp_input.c, drop the tcbinfo lock
sooner to decomplicate locking and eliminate the need for a rather chatty comment about why we have to handle the global lock in a special way for the benefit of ipfw and pf cred rules. MFC after: 3 days
This commit is contained in:
parent
5d44f8c024
commit
dd8ac7f990
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=184304
@ -896,19 +896,12 @@ tcp_input(struct mbuf *m, int off0)
|
||||
|
||||
dropwithreset:
|
||||
INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
|
||||
INP_INFO_WUNLOCK(&V_tcbinfo);
|
||||
|
||||
/*
|
||||
* If inp is non-NULL, we call tcp_dropwithreset() holding both inpcb
|
||||
* and global locks. However, if NULL, we must hold neither as
|
||||
* firewalls may acquire the global lock in order to look for a
|
||||
* matching inpcb.
|
||||
*/
|
||||
if (inp != NULL) {
|
||||
tcp_dropwithreset(m, th, tp, tlen, rstreason);
|
||||
INP_WUNLOCK(inp);
|
||||
}
|
||||
INP_INFO_WUNLOCK(&V_tcbinfo);
|
||||
if (inp == NULL)
|
||||
} else
|
||||
tcp_dropwithreset(m, th, NULL, tlen, rstreason);
|
||||
m = NULL; /* mbuf chain got consumed. */
|
||||
goto drop;
|
||||
@ -2498,19 +2491,12 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
|
||||
|
||||
dropwithreset:
|
||||
KASSERT(headlocked, ("%s: dropwithreset: head not locked", __func__));
|
||||
INP_INFO_WUNLOCK(&V_tcbinfo);
|
||||
|
||||
/*
|
||||
* If tp is non-NULL, we call tcp_dropwithreset() holding both inpcb
|
||||
* and global locks. However, if NULL, we must hold neither as
|
||||
* firewalls may acquire the global lock in order to look for a
|
||||
* matching inpcb.
|
||||
*/
|
||||
if (tp != NULL) {
|
||||
tcp_dropwithreset(m, th, tp, tlen, rstreason);
|
||||
INP_WUNLOCK(tp->t_inpcb);
|
||||
}
|
||||
INP_INFO_WUNLOCK(&V_tcbinfo);
|
||||
if (tp == NULL)
|
||||
} else
|
||||
tcp_dropwithreset(m, th, NULL, tlen, rstreason);
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user