stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "libnvdimm, btt: check memory allocation failure" has been added to the 4.13-stable tree
@ 2017-09-18  8:31 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-09-18  8:31 UTC (permalink / raw)
  To: christophe.jaillet, dan.j.williams, gregkh, vishal.l.verma
  Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    libnvdimm, btt: check memory allocation failure

to the 4.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     libnvdimm-btt-check-memory-allocation-failure.patch
and it can be found in the queue-4.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From ed36b4dba54a421ce5551638f6a9790b2c2116b1 Mon Sep 17 00:00:00 2001
From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Date: Sun, 27 Aug 2017 08:30:34 +0200
Subject: libnvdimm, btt: check memory allocation failure

From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>

commit ed36b4dba54a421ce5551638f6a9790b2c2116b1 upstream.

Check memory allocation failures and return -ENOMEM in such cases, as
already done few lines below for another memory allocation.

This avoids NULL pointers dereference.

Fixes: 14e494542636 ("libnvdimm, btt: BTT updates for UEFI 2.7 format")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/nvdimm/btt.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1429,6 +1429,8 @@ int nvdimm_namespace_attach_btt(struct n
 	}
 
 	btt_sb = devm_kzalloc(&nd_btt->dev, sizeof(*btt_sb), GFP_KERNEL);
+	if (!btt_sb)
+		return -ENOMEM;
 
 	/*
 	 * If this returns < 0, that is ok as it just means there wasn't


Patches currently in stable-queue which might be from christophe.jaillet@wanadoo.fr are

queue-4.13/libnvdimm-btt-check-memory-allocation-failure.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-18  8:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-18  8:31 Patch "libnvdimm, btt: check memory allocation failure" has been added to the 4.13-stable tree gregkh

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).