lkml.org 
[lkml]   [2019]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 08/99] dlm: memory leaks on error path in dlm_user_request()
    3.16.65-rc1 review patch.  If anyone has any objections, please let me know.

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

    From: Vasily Averin <vvs@virtuozzo.com>

    commit d47b41aceeadc6b58abc9c7c6485bef7cfb75636 upstream.

    According to comment in dlm_user_request() ua should be freed
    in dlm_free_lkb() after successful attach to lkb.

    However ua is attached to lkb not in set_lock_args() but later,
    inside request_lock().

    Fixes 597d0cae0f99 ("[DLM] dlm: user locks")

    Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
    Signed-off-by: David Teigland <teigland@redhat.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    fs/dlm/lock.c | 14 +++++++-------
    1 file changed, 7 insertions(+), 7 deletions(-)

    --- a/fs/dlm/lock.c
    +++ b/fs/dlm/lock.c
    @@ -5795,20 +5795,20 @@ int dlm_user_request(struct dlm_ls *ls,
    goto out;
    }
    }
    -
    - /* After ua is attached to lkb it will be freed by dlm_free_lkb().
    - When DLM_IFL_USER is set, the dlm knows that this is a userspace
    - lock and that lkb_astparam is the dlm_user_args structure. */
    -
    error = set_lock_args(mode, &ua->lksb, flags, namelen, timeout_cs,
    fake_astfn, ua, fake_bastfn, &args);
    - lkb->lkb_flags |= DLM_IFL_USER;
    -
    if (error) {
    + kfree(ua->lksb.sb_lvbptr);
    + ua->lksb.sb_lvbptr = NULL;
    + kfree(ua);
    __put_lkb(ls, lkb);
    goto out;
    }

    + /* After ua is attached to lkb it will be freed by dlm_free_lkb().
    + When DLM_IFL_USER is set, the dlm knows that this is a userspace
    + lock and that lkb_astparam is the dlm_user_args structure. */
    + lkb->lkb_flags |= DLM_IFL_USER;
    error = request_lock(ls, lkb, name, namelen, &args);

    switch (error) {
    \
     
     \ /
      Last update: 2019-04-02 15:40    [W:4.052 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site