lkml.org 
[lkml]   [2018]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 098/328] xfrm: Validate address prefix lengths in the xfrm selector.
    3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Steffen Klassert <steffen.klassert@secunet.com>

    commit 07bf7908950a8b14e81aa1807e3c667eab39287a upstream.

    We don't validate the address prefix lengths in the xfrm
    selector we got from userspace. This can lead to undefined
    behaviour in the address matching functions if the prefix
    is too big for the given address family. Fix this by checking
    the prefixes and refuse SA/policy insertation when a prefix
    is invalid.

    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: Air Icy <icytxw@gmail.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    net/xfrm/xfrm_user.c | 12 ++++++++++++
    1 file changed, 12 insertions(+)

    --- a/net/xfrm/xfrm_user.c
    +++ b/net/xfrm/xfrm_user.c
    @@ -150,10 +150,16 @@ static int verify_newsa_info(struct xfrm
    err = -EINVAL;
    switch (p->family) {
    case AF_INET:
    + if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32)
    + goto out;
    +
    break;

    case AF_INET6:
    #if IS_ENABLED(CONFIG_IPV6)
    + if (p->sel.prefixlen_d > 128 || p->sel.prefixlen_s > 128)
    + goto out;
    +
    break;
    #else
    err = -EAFNOSUPPORT;
    @@ -1227,10 +1233,16 @@ static int verify_newpolicy_info(struct

    switch (p->sel.family) {
    case AF_INET:
    + if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32)
    + return -EINVAL;
    +
    break;

    case AF_INET6:
    #if IS_ENABLED(CONFIG_IPV6)
    + if (p->sel.prefixlen_d > 128 || p->sel.prefixlen_s > 128)
    + return -EINVAL;
    +
    break;
    #else
    return -EAFNOSUPPORT;
    \
     
     \ /
      Last update: 2018-12-09 23:01    [W:4.115 / U:0.216 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site