lkml.org 
[lkml]   [2018]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.18 157/235] security: check for kstrdup() failure in lsm_append()
    Date
    4.18-stable review patch.  If anyone has any objections, please let me know.

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

    From: Eric Biggers <ebiggers@google.com>

    [ Upstream commit 87ea58433208d17295e200d56be5e2a4fe4ce7d6 ]

    lsm_append() should return -ENOMEM if memory allocation failed.

    Fixes: d69dece5f5b6 ("LSM: Add /sys/kernel/security/lsm")
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: James Morris <james.morris@microsoft.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    security/security.c | 2 ++
    1 file changed, 2 insertions(+)

    --- a/security/security.c
    +++ b/security/security.c
    @@ -118,6 +118,8 @@ static int lsm_append(char *new, char **

    if (*result == NULL) {
    *result = kstrdup(new, GFP_KERNEL);
    + if (*result == NULL)
    + return -ENOMEM;
    } else {
    /* Check if it is the last registered name */
    if (match_last_lsm(*result, new))

    \
     
     \ /
      Last update: 2018-09-24 14:50    [W:4.899 / U:0.264 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site