]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
af_key: Fix sadb_x_ipsecrequest parsing
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 13 Apr 2017 10:35:59 +0000 (18:35 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Fri, 11 Aug 2017 10:37:35 +0000 (12:37 +0200)
commite5e04019036e177d8b85947cfa5da77884d24ccc
tree8b59caa2f813923ba2b02d6e0f37b88f6d317b7c
parentff743138f104955784435445d077618aa6ec4026
af_key: Fix sadb_x_ipsecrequest parsing

BugLink: http://bugs.launchpad.net/bugs/1707233
commit 096f41d3a8fcbb8dde7f71379b1ca85fe213eded upstream.

The parsing of sadb_x_ipsecrequest is broken in a number of ways.
First of all we're not verifying sadb_x_ipsecrequest_len.  This
is needed when the structure carries addresses at the end.  Worse
we don't even look at the length when we parse those optional
addresses.

The migration code had similar parsing code that's better but
it also has some deficiencies.  The length is overcounted first
of all as it includes the header itself.  It also fails to check
the length before dereferencing the sa_family field.

This patch fixes those problems in parse_sockaddr_pair and then
uses it in parse_ipsecrequest.

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
net/key/af_key.c