All of lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: smueller@chronox.de, gregkh@linuxfoundation.org,
	herbert@gondor.apana.org.au
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "[PATCH - RESEND] crypto: AF_ALG - remove SGL terminator indicator when  chaining" has been added to the 4.4-stable tree
Date: Fri, 22 Sep 2017 11:37:20 +0200	[thread overview]
Message-ID: <150607304015045@kroah.com> (raw)
In-Reply-To: <5857040.2sfW0oRrdW@tauon.chronox.de>


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

    [PATCH - RESEND] crypto: AF_ALG - remove SGL terminator indicator when  chaining

to the 4.4-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:
     crypto-af_alg-remove-sgl-terminator-indicator-when-chaining.patch
and it can be found in the queue-4.4 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 smueller@chronox.de  Fri Sep 22 11:04:43 2017
From: Stephan Mueller <smueller@chronox.de>
Date: Thu, 21 Sep 2017 10:16:53 +0200
Subject: [PATCH - RESEND] crypto: AF_ALG - remove SGL terminator indicator when  chaining
To: herbert@gondor.apana.org.au, greg@kroah.com
Cc: linux-crypto@vger.kernel.org
Message-ID: <5857040.2sfW0oRrdW@tauon.chronox.de>

From: Stephan Mueller <smueller@chronox.de>

Fixed differently upstream as commit 2d97591ef43d ("crypto: af_alg - consolidation of duplicate code")

The SGL is MAX_SGL_ENTS + 1 in size. The last SG entry is used for the
chaining and is properly updated with the sg_chain invocation. During
the filling-in of the initial SG entries, sg_mark_end is called for each
SG entry. This is appropriate as long as no additional SGL is chained
with the current SGL. However, when a new SGL is chained and the last
SG entry is updated with sg_chain, the last but one entry still contains
the end marker from the sg_mark_end. This end marker must be removed as
otherwise a walk of the chained SGLs will cause a NULL pointer
dereference at the last but one SG entry, because sg_next will return
NULL.

The patch only applies to all kernels up to and including 4.13. The
patch 2d97591ef43d0587be22ad1b0d758d6df4999a0b added to 4.14-rc1
introduced a complete new code base which addresses this bug in
a different way. Yet, that patch is too invasive for stable kernels
and was therefore not marked for stable.

Fixes: 8ff590903d5fc ("crypto: algif_skcipher - User-space interface for skcipher operations")
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 crypto/algif_skcipher.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -143,8 +143,10 @@ static int skcipher_alloc_sgl(struct soc
 		sg_init_table(sgl->sg, MAX_SGL_ENTS + 1);
 		sgl->cur = 0;
 
-		if (sg)
+		if (sg) {
 			sg_chain(sg, MAX_SGL_ENTS + 1, sgl->sg);
+			sg_unmark_end(sg + (MAX_SGL_ENTS - 1));
+		}
 
 		list_add_tail(&sgl->list, &ctx->tsgl);
 	}


Patches currently in stable-queue which might be from smueller@chronox.de are

queue-4.4/crypto-af_alg-remove-sgl-terminator-indicator-when-chaining.patch

  parent reply	other threads:[~2017-09-22  9:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21  8:16 [PATCH - RESEND] crypto: AF_ALG - remove SGL terminator indicator when chaining Stephan Mueller
2017-09-21  8:18 ` Herbert Xu
2017-09-22  9:36 ` Patch "[PATCH - RESEND] crypto: AF_ALG - remove SGL terminator indicator when chaining" has been added to the 3.18-stable tree gregkh
2017-09-22  9:36 ` Patch "[PATCH - RESEND] crypto: AF_ALG - remove SGL terminator indicator when chaining" has been added to the 4.13-stable tree gregkh
2017-09-22  9:37 ` gregkh [this message]
2017-09-22  9:37 ` Patch "[PATCH - RESEND] crypto: AF_ALG - remove SGL terminator indicator when chaining" has been added to the 4.9-stable tree gregkh
2017-10-02  9:41 ` Patch "[PATCH - RESEND] crypto: AF_ALG - remove SGL terminator indicator when chaining" has been added to the 4.13-stable tree gregkh

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=150607304015045@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=smueller@chronox.de \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@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 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.