Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167364521
D31731.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D31731.diff
View Options
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -2804,7 +2804,7 @@
/* sctp_ifap is used to bypass normal local address validation checks */
int
sctp_inpcb_bind(struct socket *so, struct sockaddr *addr,
- struct sctp_ifa *sctp_ifap, struct thread *p)
+ struct sctp_ifa *sctp_ifap, struct thread *td)
{
/* bind a ep to a socket address */
struct sctppcbhead *head;
@@ -2816,6 +2816,8 @@
int error;
uint32_t vrf_id;
+ KASSERT(td != NULL, ("%s: null thread", __func__));
+
lport = 0;
bindall = 1;
inp = (struct sctp_inpcb *)so->so_pcb;
@@ -2833,10 +2835,6 @@
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL);
return (EINVAL);
}
-#ifdef INVARIANTS
- if (p == NULL)
- panic("null proc/thread");
-#endif
if (addr != NULL) {
switch (addr->sa_family) {
#ifdef INET
@@ -2861,7 +2859,7 @@
* will transmute the ip address to the
* proper value.
*/
- if (p && (error = prison_local_ip4(p->td_ucred, &sin->sin_addr)) != 0) {
+ if ((error = prison_local_ip4(td->td_ucred, &sin->sin_addr)) != 0) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error);
return (error);
}
@@ -2892,7 +2890,7 @@
* will transmute the ipv6 address to the
* proper value.
*/
- if (p && (error = prison_local_ip6(p->td_ucred, &sin6->sin6_addr,
+ if ((error = prison_local_ip6(td->td_ucred, &sin6->sin6_addr,
(SCTP_IPV6_V6ONLY(inp) != 0))) != 0) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error);
return (error);
@@ -2929,9 +2927,7 @@
*/
/* got to be root to get at low ports */
if (ntohs(lport) < IPPORT_RESERVED) {
- if ((p != NULL) && ((error =
- priv_check(p, PRIV_NETINET_RESERVEDPORT)
- ) != 0)) {
+ if ((error = priv_check(td, PRIV_NETINET_RESERVEDPORT)) != 0) {
SCTP_INP_DECR_REF(inp);
SCTP_INP_WUNLOCK(inp);
SCTP_INP_INFO_WUNLOCK();
@@ -3021,9 +3017,7 @@
first = MODULE_GLOBAL(ipport_hifirstauto);
last = MODULE_GLOBAL(ipport_hilastauto);
} else if (ip_inp->inp_flags & INP_LOWPORT) {
- if (p && (error =
- priv_check(p, PRIV_NETINET_RESERVEDPORT)
- )) {
+ if ((error = priv_check(td, PRIV_NETINET_RESERVEDPORT)) != 0) {
SCTP_INP_DECR_REF(inp);
SCTP_INP_WUNLOCK(inp);
SCTP_INP_INFO_WUNLOCK();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 22, 8:46 AM (1 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37069517
Default Alt Text
D31731.diff (2 KB)
Attached To
Mode
D31731: sctp: Remove always-false checks in sctp_inpcb_bind()
Attached
Detach File
Event Timeline
Log In to Comment