The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Christine Caulfield <ccaulfie@redhat.com>,
	David Teigland <teigland@redhat.com>,
	Alexander Aring <aahringo@redhat.com>,
	cluster-devel@redhat.com, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] fs: dlm: Fix memory leak of object mh
Date: Wed, 26 May 2021 18:01:33 +0300	[thread overview]
Message-ID: <20210526150133.GQ1955@kadam> (raw)
In-Reply-To: <20210526134039.3448305-1-colin.king@canonical.com>

On Wed, May 26, 2021 at 02:40:39PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There is an error return path that is not kfree'ing mh after
> it has been successfully allocates.  Fix this by free'ing it.
> 
> Addresses-Coverity: ("Resource leak")
> Fixes: a070a91cf140 ("fs: dlm: add more midcomms hooks")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  fs/dlm/rcom.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c
> index 085f21966c72..19298edc1573 100644
> --- a/fs/dlm/rcom.c
> +++ b/fs/dlm/rcom.c
> @@ -393,6 +393,7 @@ static void receive_rcom_lookup(struct dlm_ls *ls, struct dlm_rcom *rc_in)
>  	if (rc_in->rc_id == 0xFFFFFFFF) {
>  		log_error(ls, "receive_rcom_lookup dump from %d", nodeid);
>  		dlm_dump_rsb_name(ls, rc_in->rc_buf, len);
> +		kfree(mh);

Am I looking at the same code as you?  (I often am not able to review
your patches because you're doing development on stuff that hasn't hit
linux-next).  Anyway, to me this doesn't seem like the correct fix at
all.  There are some other things to free and the "mh" pointer is on
a bunch of lists so it leads to use after frees.

regards,
dan carpenter


  parent reply	other threads:[~2021-05-26 15:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 13:40 [PATCH][next] fs: dlm: Fix memory leak of object mh Colin King
2021-05-26 14:19 ` Alexander Ahring Oder Aring
2021-05-26 14:21   ` Colin Ian King
2021-05-26 15:01 ` Dan Carpenter [this message]
2021-05-26 15:11   ` Colin Ian King
2021-05-26 18:24     ` Dan Carpenter
2021-05-26 18:50       ` Alexander Ahring Oder Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210526150133.GQ1955@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=aahringo@redhat.com \
    --cc=ccaulfie@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=teigland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox