aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-06-16 13:46:56 +0000
committerMark Johnston <markj@FreeBSD.org>2021-06-29 17:09:43 +0000
commit4647d115ff849534c9d6712cc2da32509721e20e (patch)
tree4b5b2593050914ffe807de5affbb931456a76d29
parent78f91c1fbf02b8768ebd8dd005eb922970ff4837 (diff)
downloadsrc-4647d115ff849534c9d6712cc2da32509721e20e.tar.gz
src-4647d115ff849534c9d6712cc2da32509721e20e.zip
ipfw: Update the pfil mbuf pointer in ipfw_check_frame()
ipfw_chk() might call m_pullup() and thus can change the mbuf chain head. In this case, the new chain head has to be returned to the pfil hook caller, otherwise the pfil hook caller is left with a dangling pointer. Note that this affects only the link-layer hooks installed when the net.link.ether.ipfw sysctl is set to 1. Approved by: so Security: EN-21:21.ipfw PR: 256439, 254015, 255069, 255104 Fixes: f355cb3e6 Reviewed by: ae Sponsored by: The FreeBSD Foundation (cherry picked from commit bc6a2267fffeafd3946637607a74cfd639398f9d) (cherry picked from commit ed1acef3fe3053b418ce3e41036ccf24957253a4)
-rw-r--r--sys/netpfil/ipfw/ip_fw_pfil.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/netpfil/ipfw/ip_fw_pfil.c b/sys/netpfil/ipfw/ip_fw_pfil.c
index e21831c80ec6..01a44df47180 100644
--- a/sys/netpfil/ipfw/ip_fw_pfil.c
+++ b/sys/netpfil/ipfw/ip_fw_pfil.c
@@ -371,6 +371,8 @@ again:
}
ipfw = ipfw_chk(&args);
+ if (!mem)
+ *p.m = args.m;
ret = PFIL_PASS;
switch (ipfw) {