Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153331576
D9035.id23585.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D9035.id23585.diff
View Options
Index: sys/netinet/tcp_input.c
===================================================================
--- sys/netinet/tcp_input.c
+++ sys/netinet/tcp_input.c
@@ -1408,7 +1408,10 @@
tcp_trace(TA_INPUT, ostate, tp,
(void *)tcp_saveipgen, &tcp_savetcp, 0);
#endif
- TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+ if (m != NULL)
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+ else
+ TCP_PROBE3(debug__input, tp, th, 0);
tcp_dooptions(&to, optp, optlen, TO_SYN);
#ifdef TCP_RFC7413
if (syncache_add(&inc, &to, th, inp, &so, m, NULL, NULL))
@@ -1456,7 +1459,11 @@
}
#endif
- TCP_PROBE5(receive, NULL, tp, mtod(m, const char *), tp, th);
+ if (m != NULL)
+ TCP_PROBE5(receive, NULL, tp, mtod(m, const char *), tp, th);
+ else
+ TCP_PROBE5(receive, NULL, tp, 0, tp, th);
+
/*
* Segment belongs to a connection in SYN_SENT, ESTABLISHED or later
@@ -1468,7 +1475,10 @@
return (IPPROTO_DONE);
dropwithreset:
- TCP_PROBE5(receive, NULL, tp, mtod(m, const char *), tp, th);
+ if (m != NULL)
+ TCP_PROBE5(receive, NULL, tp, mtod(m, const char *), tp, th);
+ else
+ TCP_PROBE5(receive, NULL, tp, 0, tp, th);
if (ti_locked == TI_RLOCKED) {
INP_INFO_RUNLOCK(&V_tcbinfo);
@@ -1493,6 +1503,8 @@
dropunlock:
if (m != NULL)
TCP_PROBE5(receive, NULL, tp, mtod(m, const char *), tp, th);
+ else
+ TCP_PROBE5(receive, NULL, tp, 0, tp, th);
if (ti_locked == TI_RLOCKED) {
INP_INFO_RUNLOCK(&V_tcbinfo);
@@ -1826,8 +1838,12 @@
(void *)tcp_saveipgen,
&tcp_savetcp, 0);
#endif
- TCP_PROBE3(debug__input, tp, th,
- mtod(m, const char *));
+ if (m != NULL)
+ TCP_PROBE3(debug__input, tp, th,
+ mtod(m, const char *));
+ else
+ TCP_PROBE3(debug__input, tp, th,
+ 0);
if (tp->snd_una == tp->snd_max)
tcp_timer_activate(tp, TT_REXMT, 0);
else if (!tcp_timer_active(tp, TT_PERSIST))
@@ -1873,7 +1889,10 @@
tcp_trace(TA_INPUT, ostate, tp,
(void *)tcp_saveipgen, &tcp_savetcp, 0);
#endif
- TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+ if (m != NULL)
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+ else
+ TCP_PROBE3(debug__input, tp, th, 0);
/*
* Automatic sizing of receive socket buffer. Often the send
@@ -2034,8 +2053,12 @@
goto dropwithreset;
}
if ((thflags & (TH_ACK|TH_RST)) == (TH_ACK|TH_RST)) {
- TCP_PROBE5(connect__refused, NULL, tp,
- mtod(m, const char *), tp, th);
+ if (m != NULL)
+ TCP_PROBE5(connect__refused, NULL, tp,
+ mtod(m, const char *), tp, th);
+ else
+ TCP_PROBE5(connect__refused, NULL, tp,
+ 0, tp, th);
tp = tcp_drop(tp, ECONNREFUSED);
}
if (thflags & TH_RST)
@@ -2087,8 +2110,12 @@
thflags &= ~TH_SYN;
} else {
tcp_state_change(tp, TCPS_ESTABLISHED);
- TCP_PROBE5(connect__established, NULL, tp,
- mtod(m, const char *), tp, th);
+ if (m != NULL)
+ TCP_PROBE5(connect__established, NULL, tp,
+ mtod(m, const char *), tp, th);
+ else
+ TCP_PROBE5(connect__established, NULL, tp,
+ 0, tp, th);
cc_conn_init(tp);
tcp_timer_activate(tp, TT_KEEP,
TP_KEEPIDLE(tp));
@@ -2467,8 +2494,12 @@
tp->t_flags &= ~TF_NEEDFIN;
} else {
tcp_state_change(tp, TCPS_ESTABLISHED);
- TCP_PROBE5(accept__established, NULL, tp,
- mtod(m, const char *), tp, th);
+ if (m != NULL)
+ TCP_PROBE5(accept__established, NULL, tp,
+ mtod(m, const char *), tp, th);
+ else
+ TCP_PROBE5(accept__established, NULL, tp,
+ 0, tp, th);
#ifdef TCP_RFC7413
if (tp->t_tfo_pending) {
tcp_fastopen_decrement_counter(tp->t_tfo_pending);
@@ -3202,7 +3233,10 @@
tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen,
&tcp_savetcp, 0);
#endif
- TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+ if (m != NULL)
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+ else
+ TCP_PROBE3(debug__input, tp, th, 0);
/*
* Return any desired output.
@@ -3250,7 +3284,10 @@
tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen,
&tcp_savetcp, 0);
#endif
- TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+ if (m != NULL)
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+ else
+ TCP_PROBE3(debug__input, tp, th, 0);
if (ti_locked == TI_RLOCKED)
INP_INFO_RUNLOCK(&V_tcbinfo);
ti_locked = TI_UNLOCKED;
@@ -3291,7 +3328,10 @@
tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen,
&tcp_savetcp, 0);
#endif
- TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+ if (m != NULL)
+ TCP_PROBE3(debug__input, tp, th, mtod(m, const char *));
+ else
+ TCP_PROBE3(debug__input, tp, th, 0);
if (tp != NULL)
INP_WUNLOCK(tp->t_inpcb);
m_freem(m);
Index: sys/netinet/tcp_output.c
===================================================================
--- sys/netinet/tcp_output.c
+++ sys/netinet/tcp_output.c
@@ -1339,7 +1339,10 @@
ipov->ih_len = save;
}
#endif /* TCPDEBUG */
- TCP_PROBE3(debug__output, tp, th, mtod(m, const char *));
+ if (m != NULL)
+ TCP_PROBE3(debug__output, tp, th, mtod(m, const char *));
+ else
+ TCP_PROBE3(debug__output, tp, th, 0);
/*
* Fill in IP length and desired time to live and
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 21, 1:00 PM (5 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31911857
Default Alt Text
D9035.id23585.diff (5 KB)
Attached To
Mode
D9035: Protect calls to mtod() from accessing NULL mbufs
Attached
Detach File
Event Timeline
Log In to Comment