]> git.baikalelectronics.ru Git - kernel.git/commit
net/ipv4: defensive cipso option parsing
authorStefan Nuernberger <snu@amazon.com>
Mon, 17 Sep 2018 17:46:53 +0000 (19:46 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Sep 2018 02:37:46 +0000 (19:37 -0700)
commita06133ec836c3ca29795bc5ac0fbbcec050c34ab
treef40d60c2bccd9cee2a8b592955b0c1b500c76b01
parent6b3e8e361ee7aa8d165e137e5f53ed1d3ffcc45f
net/ipv4: defensive cipso option parsing

commit 22d7e67c34fe ("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>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: Simon Veith <sveith@amazon.de>
Cc: stable@vger.kernel.org
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/cipso_ipv4.c