lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220107080559.122713-1-ooppublic@163.com>
Date:   Fri,  7 Jan 2022 16:05:59 +0800
From:   ooppublic@....com
To:     davem@...emloft.net
Cc:     dsahern@...nel.org, netdev@...r.kernel.org,
        caixf <ooppublic@....com>
Subject: [PATCH] net: fix fragments have the disallowed options

From: caixf <ooppublic@....com>

When in function ip_do_fragment() enter fsat path,
if skb have opthons, all fragments will have the same options.

Just guarantee the second fragment not have the disallowed options.

Signed-off-by: caixf <ooppublic@....com>
---
 net/ipv4/ip_output.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 9bca57ef8b83..ce178b5eb848 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -826,15 +826,16 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
 		/* Everything is OK. Generate! */
 		ip_fraglist_init(skb, iph, hlen, &iter);
 
-		if (iter.frag)
-			ip_options_fragment(iter.frag);
-
 		for (;;) {
 			/* Prepare header of the next frame,
 			 * before previous one went down. */
 			if (iter.frag) {
+				bool first_frag = (iter.offset == 0);
+
 				IPCB(iter.frag)->flags = IPCB(skb)->flags;
 				ip_fraglist_prepare(skb, &iter);
+				if (first_frag)
+					ip_options_fragment(iter.frag);
 			}
 
 			skb->tstamp = tstamp;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ