From: Stefan Nuernberger snu@amazon.com Date: Mon, 17 Sep 2018 19:46:53 +0200
commit 40413955ee26 ("Cipso: cipso_v4_optptr enter infinite loop") fixed a possible infinite loop in the IP option parsing of CIPSO. The fix assumes that ip_options_compile filtered out all zero length options and that no other one-byte options beside IPOPT_END and IPOPT_NOOP exist. While this assumption currently holds true, add explicit checks for zero length and invalid length options to be safe for the future. Even though ip_options_compile should have validated the options, the introduction of new one-byte options can still confuse this code without the additional checks.
Signed-off-by: Stefan Nuernberger snu@amazon.com
Applied to net-next.
This is not 'net' nor -stable material. I'm hesitent about this change as-is, and ip_options_compile() is not changing semantics in -stable in the way that you say can cause problems.