linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Colin King <colin.king@canonical.com>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>, Parav Pandit <parav@nvidia.com>,
	virtualization@lists.linux-foundation.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] vdpa/mlx5: Fix resource leak of mgtdev due to incorrect kfree
Date: Tue, 13 Apr 2021 09:29:34 +0200	[thread overview]
Message-ID: <20210413072934.ibz7iersn5byad3h@steredhat> (raw)
In-Reply-To: <20210412162804.1628738-1-colin.king@canonical.com>

On Mon, Apr 12, 2021 at 05:28:04PM +0100, Colin King wrote:
>From: Colin Ian King <colin.king@canonical.com>
>
>Static analysis is reporting a memory leak on mgtdev, it appears
>that the wrong object is being kfree'd. Fix this by kfree'ing
>mgtdev rather than mdev.
>
>Addresses-Coverity: ("Resource leak")
>Fixes: c8a2d4c73e70 ("vdpa/mlx5: Enable user to add/delete vdpa device")
>Signed-off-by: Colin Ian King <colin.king@canonical.com>
>---
> drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>index 10c5fef3c020..25533db01f5f 100644
>--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
>+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>@@ -2089,7 +2089,7 @@ static int mlx5v_probe(struct auxiliary_device *adev,
> 	return 0;
>
> reg_err:
>-	kfree(mdev);
>+	kfree(mgtdev);
> 	return err;
> }
>
>-- 
>2.30.2
>

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>


      parent reply	other threads:[~2021-04-13  7:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 16:28 [PATCH][next] vdpa/mlx5: Fix resource leak of mgtdev due to incorrect kfree Colin King
2021-04-13  2:50 ` Jason Wang
2021-04-13  7:29 ` Stefano Garzarella [this message]

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=20210413072934.ibz7iersn5byad3h@steredhat \
    --to=sgarzare@redhat.com \
    --cc=colin.king@canonical.com \
    --cc=jasowang@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=parav@nvidia.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).