lkml.org 
[lkml]   [2018]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 060/183] kconfig: Fix expr_free() E_NOT leak
    Date
    4.14-stable review patch.  If anyone has any objections, please let me know.

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

    From: Ulf Magnusson <ulfalizer@gmail.com>


    [ Upstream commit 5b1374b3b3c2fc4f63a398adfa446fb8eff791a4 ]

    Only the E_NOT operand and not the E_NOT node itself was freed, due to
    accidentally returning too early in expr_free(). Outline of leak:

    switch (e->type) {
    ...
    case E_NOT:
    expr_free(e->left.expr);
    return;
    ...
    }
    *Never reached, 'e' leaked*
    free(e);

    Fix by changing the 'return' to a 'break'.

    Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:

    LEAK SUMMARY:
    definitely lost: 44,448 bytes in 1,852 blocks
    ...

    Summary after the fix:

    LEAK SUMMARY:
    definitely lost: 1,608 bytes in 67 blocks
    ...

    Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
    Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    scripts/kconfig/expr.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/scripts/kconfig/expr.c
    +++ b/scripts/kconfig/expr.c
    @@ -113,7 +113,7 @@ void expr_free(struct expr *e)
    break;
    case E_NOT:
    expr_free(e->left.expr);
    - return;
    + break;
    case E_EQUAL:
    case E_GEQ:
    case E_GTH:

    \
     
     \ /
      Last update: 2018-04-25 13:22    [W:4.119 / U:0.352 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site