public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nfit: fix _FIT evaluation memory leak
@ 2016-07-15  3:28 Dan Williams
  2016-07-15  3:29 ` [PATCH 2/2] nfit: cleanup acpi_nfit_init calling convention Dan Williams
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Dan Williams @ 2016-07-15  3:28 UTC (permalink / raw)
  To: linux-nvdimm
  Cc: Vishal Verma, linux-acpi, stable, Xiao Guangrong, Haozhong Zhang

acpi_evaluate_object() allocates memory. Free the buffer allocated
during acpi_nfit_add().

Cc: <stable@vger.kernel.org>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Reported-by: Xiao Guangrong <guangrong.xiao@intel.com>
Reported-by: Haozhong Zhang <haozhong.zhang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/acpi/nfit.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index 0497175ee6cb..008dbaaa2b75 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -2414,12 +2414,15 @@ static int acpi_nfit_add(struct acpi_device *adev)
 			acpi_desc->nfit =
 				(struct acpi_nfit_header *)obj->buffer.pointer;
 			sz = obj->buffer.length;
+			rc = acpi_nfit_init(acpi_desc, sz);
 		} else
 			dev_dbg(dev, "%s invalid type %d, ignoring _FIT\n",
 				 __func__, (int) obj->type);
-	}
+		kfree(buf.pointer);
+		acpi_desc->nfit = NULL;
+	} else
+		rc = acpi_nfit_init(acpi_desc, sz);
 
-	rc = acpi_nfit_init(acpi_desc, sz);
 	if (rc) {
 		nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
 		return rc;


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-07-15 17:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-15  3:28 [PATCH 1/2] nfit: fix _FIT evaluation memory leak Dan Williams
2016-07-15  3:29 ` [PATCH 2/2] nfit: cleanup acpi_nfit_init calling convention Dan Williams
     [not found]   ` <146855334233.573.9365432658382592535.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-07-15  8:40     ` joeyli
     [not found] ` <146855333714.573.13934675433503265133.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-07-15  5:15   ` [PATCH 1/2] nfit: fix _FIT evaluation memory leak joeyli
2016-07-15  5:27     ` Dan Williams
2016-07-15  5:47 ` Xiao Guangrong
2016-07-15 14:57   ` Dan Williams
2016-07-15  7:55 ` Haozhong Zhang
2016-07-15  8:12   ` Haozhong Zhang
2016-07-15 17:10     ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox