]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:57:10 +0000 (19:57 -0600)
commit4f4ecde0d11320e3ae171a9d4588943e964c03d5
tree0361ce24fb5c4906af4d8ad03a344031fc86578c
parent5825c5978cc0976758bd5c0b8aa116c85982c319
net/ipv4: defensive cipso option parsing

BugLink: https://bugs.launchpad.net/bugs/1836802
commit 076ed3da0c9b2f88d9157dbe7044a45641ae369e upstream.

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>
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/ipv4/cipso_ipv4.c