lkml.org 
[lkml]   [2018]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.18 003/121] af_key: Fix slab-out-of-bounds in pfkey_compile_policy.
    Date
    3.18-stable review patch.  If anyone has any objections, please let me know.

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

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


    [ Upstream commit d90c902449a7561f1b1d58ba5a0d11728ce8b0b2 ]

    The sadb_x_sec_len is stored in the unit 'byte divided by eight'.
    So we have to multiply this value by eight before we can do
    size checks. Otherwise we may get a slab-out-of-bounds when
    we memcpy the user sec_ctx.

    Fixes: df71837d502 ("[LSM-IPSec]: Security association restriction.")
    Reported-by: Andrey Konovalov <andreyknvl@google.com>
    Tested-by: Andrey Konovalov <andreyknvl@google.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    net/key/af_key.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/net/key/af_key.c
    +++ b/net/key/af_key.c
    @@ -3301,7 +3301,7 @@ static struct xfrm_policy *pfkey_compile
    p += pol->sadb_x_policy_len*8;
    sec_ctx = (struct sadb_x_sec_ctx *)p;
    if (len < pol->sadb_x_policy_len*8 +
    - sec_ctx->sadb_x_sec_len) {
    + sec_ctx->sadb_x_sec_len*8) {
    *dir = -EINVAL;
    goto out;
    }

    \
     
     \ /
      Last update: 2018-04-11 23:27    [W:4.037 / U:0.056 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site