mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dongliang Mu <dzm91@hust.edu.cn>
To: "David E. Box" <david.e.box@linux.intel.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Mark Gross <markgross@kernel.org>
Cc: Dongliang Mu <dzm91@hust.edu.cn>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH linux-next v2 3/3] drivers/platform/x86/intel: fix a memory leak in intel_vsec_add_aux
Date: Thu,  9 Mar 2023 12:01:07 +0800	[thread overview]
Message-ID: <20230309040107.534716-4-dzm91@hust.edu.cn> (raw)
In-Reply-To: <20230309040107.534716-1-dzm91@hust.edu.cn>

The first error handling code in intel_vsec_add_aux misses the
deallocation of intel_vsec_dev->resource.

Fix this by adding kfree(intel_vsec_dev->resource) in the error handling
code.

Reviewed-by: David E. Box <david.e.box@linux.intel.com>
Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
---
 drivers/platform/x86/intel/vsec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/platform/x86/intel/vsec.c b/drivers/platform/x86/intel/vsec.c
index 13decf36c6de..2311c16cb975 100644
--- a/drivers/platform/x86/intel/vsec.c
+++ b/drivers/platform/x86/intel/vsec.c
@@ -154,6 +154,7 @@ int intel_vsec_add_aux(struct pci_dev *pdev, struct device *parent,
 	ret = ida_alloc(intel_vsec_dev->ida, GFP_KERNEL);
 	mutex_unlock(&vsec_ida_lock);
 	if (ret < 0) {
+		kfree(intel_vsec_dev->resource);
 		kfree(intel_vsec_dev);
 		return ret;
 	}
-- 
2.39.2


  parent reply	other threads:[~2023-03-09  4:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230309040107.534716-1-dzm91@hust.edu.cn>
2023-03-09  4:01 ` [PATCH linux-next v2 1/3] platform/x86/intel/tpmi: Fix double free in tpmi_create_device() Dongliang Mu
2023-03-14 14:22   ` Dan Carpenter
2023-03-16 14:25   ` Hans de Goede
2023-03-16 18:18     ` srinivas pandruvada
2023-03-17  1:28       ` Dongliang Mu
2023-03-17  8:51         ` Hans de Goede
2023-03-17 10:23           ` srinivas pandruvada
2023-03-17 11:57             ` Dongliang Mu
2023-03-17 10:27         ` srinivas pandruvada
2023-03-20  2:43           ` Dongliang Mu
2023-03-20  6:32             ` srinivas pandruvada
2023-03-20 10:32   ` Hans de Goede
2023-03-09  4:01 ` [PATCH linux-next v2 2/3] drivers/platform/x86/intel/tpmi: revise the comment of intel_vsec_add_aux Dongliang Mu
2023-03-20 10:33   ` Hans de Goede
2023-03-20 10:57     ` Dongliang Mu
2023-03-20 13:40       ` Hans de Goede
2023-03-09  4:01 ` Dongliang Mu [this message]
2023-03-20 10:31   ` [PATCH linux-next v2 3/3] drivers/platform/x86/intel: fix a memory leak in intel_vsec_add_aux Hans de Goede

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=20230309040107.534716-4-dzm91@hust.edu.cn \
    --to=dzm91@hust.edu.cn \
    --cc=david.e.box@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.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

all inboxes | Powered by JetHome®