aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2019-01-09 06:36:57 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2019-01-09 06:36:57 +0000
commit10731c54b6dbef8894a184800e861f19a63f1fa0 (patch)
tree0238687abfe83f4c3da5192c5201c4d7dae9882f /sys
parentd60f35d973db00e8bd50b5cad246d305afd61e53 (diff)
downloadsrc-10731c54b6dbef8894a184800e861f19a63f1fa0.tar.gz
src-10731c54b6dbef8894a184800e861f19a63f1fa0.zip
Fix getsockopt() for IP_OPTIONS/IP_RETOPTS.
r336616 copies inp->inp_options using the m_dup() function. However, this function expects an mbuf packet header at the beginning, which is not true in this case. Therefore, use m_copym() instead of m_dup(). This issue was found by syzkaller. Reviewed by: mmacy@ MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D18753
Notes
Notes: svn path=/head/; revision=342879
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_output.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index bbbb4cf77d3f..7595c3f90535 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1263,7 +1263,8 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
if (inp->inp_options) {
struct mbuf *options;
- options = m_dup(inp->inp_options, M_NOWAIT);
+ options = m_copym(inp->inp_options, 0,
+ M_COPYALL, M_NOWAIT);
INP_RUNLOCK(inp);
if (options != NULL) {
error = sooptcopyout(sopt,