lkml.org 
[lkml]   [2020]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.10 578/717] dyndbg: fix use before null check
    Date
    From: Jim Cromie <jim.cromie@gmail.com>

    commit 3577afb0052fca65e67efdfc8e0859bb7bac87a6 upstream.

    In commit a2d375eda771 ("dyndbg: refine export, rename to
    dynamic_debug_exec_queries()"), a string is copied before checking it
    isn't NULL. Fix this, report a usage/interface error, and return the
    proper error code.

    Fixes: a2d375eda771 ("dyndbg: refine export, rename to dynamic_debug_exec_queries()")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    Link: https://lore.kernel.org/r/20201209183625.2432329-1-jim.cromie@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    lib/dynamic_debug.c | 9 +++++++--
    1 file changed, 7 insertions(+), 2 deletions(-)

    --- a/lib/dynamic_debug.c
    +++ b/lib/dynamic_debug.c
    @@ -561,9 +561,14 @@ static int ddebug_exec_queries(char *que
    int dynamic_debug_exec_queries(const char *query, const char *modname)
    {
    int rc;
    - char *qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL);
    + char *qry; /* writable copy of query */

    - if (!query)
    + if (!query) {
    + pr_err("non-null query/command string expected\n");
    + return -EINVAL;
    + }
    + qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL);
    + if (!qry)
    return -ENOMEM;

    rc = ddebug_exec_queries(qry, modname);

    \
     
     \ /
      Last update: 2020-12-28 15:42    [W:5.002 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site