All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nfit: fix _FIT evaluation memory leak
@ 2016-07-15  3:28 ` Dan Williams
  0 siblings, 0 replies; 21+ messages in thread
From: Dan Williams @ 2016-07-15  3:28 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Xiao Guangrong, stable, linux-acpi

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;

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

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

Thread overview: 21+ 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:28 ` Dan Williams
2016-07-15  3:29 ` [PATCH 2/2] nfit: cleanup acpi_nfit_init calling convention Dan Williams
2016-07-15  3:29   ` Dan Williams
2016-07-15  8:40   ` joeyli
2016-07-15  8:40     ` joeyli
2016-07-15  5:15 ` [PATCH 1/2] nfit: fix _FIT evaluation memory leak joeyli
2016-07-15  5:15   ` joeyli
2016-07-15  5:15   ` joeyli
2016-07-15  5:27   ` Dan Williams
2016-07-15  5:27     ` Dan Williams
2016-07-15  5:47 ` Xiao Guangrong
2016-07-15  5:47   ` Xiao Guangrong
2016-07-15 14:57   ` Dan Williams
2016-07-15 14:57     ` Dan Williams
2016-07-15  7:55 ` Haozhong Zhang
2016-07-15  7:55   ` Haozhong Zhang
2016-07-15  8:12   ` Haozhong Zhang
2016-07-15  8:12     ` Haozhong Zhang
2016-07-15 17:10     ` Dan Williams
2016-07-15 17:10       ` Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.