All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Kees Cook <keescook@chromium.org>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>,
	Andrew Morton <akpm@linuxfoundation.org>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>
Subject: [patch 7/8] dm verity fec: Check result of init_rs()
Date: Wed, 28 Mar 2018 22:51:45 +0200	[thread overview]
Message-ID: <20180328205554.845997973@linutronix.de> (raw)
In-Reply-To: 20180328205138.301218351@linutronix.de

[-- Attachment #1: dm-verity-fec--Check-result-of-init_rs--.patch --]
[-- Type: text/plain, Size: 780 bytes --]

The allocation of the reed solomon control structure can fail, but
fec_alloc_bufs() ignores that and subsequent operations in dm verity use
the potential NULL pointer unconditionally.

Add a proper check and abort if init_rs() fails.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/md/dm-verity-fec.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/drivers/md/dm-verity-fec.c
+++ b/drivers/md/dm-verity-fec.c
@@ -308,8 +308,13 @@ static int fec_alloc_bufs(struct dm_veri
 {
 	unsigned n;
 
-	if (!fio->rs)
+	if (!fio->rs) {
 		fio->rs = mempool_alloc(v->fec->rs_pool, GFP_NOIO);
+		if (!fio->rs) {
+			DMERR("failed to allocate RS control structure");
+			return -ENOMEM;
+		}
+	}
 
 	fec_for_each_prealloc_buffer(n) {
 		if (fio->bufs[n])

  parent reply	other threads:[~2018-03-28 20:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 20:51 [patch 0/8] rslib: Cleanup and VLA removal Thomas Gleixner
2018-03-28 20:51 ` [patch 1/8] rslib: Cleanup whitespace damage Thomas Gleixner
2018-03-28 20:51 ` [patch 2/8] rslib: Cleanup top level comments Thomas Gleixner
2018-03-28 20:51 ` [patch 3/8] rslib: Add SPDX identifiers Thomas Gleixner
2018-03-28 21:59   ` Segher Boessenkool
2018-03-28 20:51 ` [patch 4/8] rslib: Remove GPL boilerplate Thomas Gleixner
2018-03-28 20:51 ` [patch 5/8] rslib: Split rs control struct Thomas Gleixner
2018-04-04 19:40   ` Boris Brezillon
2018-04-18 17:03     ` Kees Cook
2018-04-19  8:16       ` Thomas Gleixner
2018-03-28 20:51 ` [patch 6/8] mtd: diskonchip: Allocate rs control per instance Thomas Gleixner
2018-04-04 19:52   ` Boris Brezillon
2018-03-28 20:51 ` Thomas Gleixner [this message]
2018-03-28 20:51 ` [patch 8/8] rslib: Allocate decoder buffers to avoid VLAs Thomas Gleixner
2018-03-28 21:14   ` Kees Cook

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=20180328205554.845997973@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=agk@redhat.com \
    --cc=akpm@linuxfoundation.org \
    --cc=anton@enomsg.org \
    --cc=boris.brezillon@free-electrons.com \
    --cc=ccross@android.com \
    --cc=dwmw2@infradead.org \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=segher@kernel.crashing.org \
    --cc=snitzer@redhat.com \
    --cc=tony.luck@intel.com \
    /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 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.