mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Torsten Duwe <duwe@lst.de>
To: Jiri Slaby <jslaby@suse.cz>
Cc: stable@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] Fix af_alg in 3.12
Date: Tue, 14 Feb 2017 16:30:46 +0100	[thread overview]
Message-ID: <20170214153046.GB27168@lst.de> (raw)
In-Reply-To: <20170203120548.GA31291@lst.de>

On Fri, Feb 03, 2017 at 01:05:48PM +0100, Torsten Duwe wrote:
> 
> If Herbert does not have a better idea, I suggest to back out this change and fix
> dynamically allocated key structures for the individual algorithms instead, for
> the older branches.

So, the solution IMHO is to revert

b2a0707817d3dec83652bb460a7775613058aedd
f382cd5ac26674877143fa7d9c0ea23c6640e706
c25e22ff51d3bebf579a054aecbaa98c81149c02
1e3f8a31f01e5967fcf413d72832ce41aa4efd1d
79adba68c32883c6559dc80040e97c35e208c7f1
82a0aa2c08de674191cf5e99b649af145c5ade25

that is the whole sequence from 82a0aa2c08de674191..b2a0707817d3dec836
backwards sans b9da7c51a11a2e7 which is a separate, unrelated fix.

This series aimed to fix the whole class of problems and creates and fixes
its own ABI breakage. But since that problem class contains exactly
1 element, fix instead the one broken algorithm with a dynamically
allocated member in its context that gets initialised during setkey.

Signed-off-by: Torsten Duwe <duwe@suse.de>
Cc: <stable@vger.kernel.org> # v3.0+

diff --git a/crypto/lrw.c b/crypto/lrw.c
index 6f9908a..4c9257d 100644
--- a/crypto/lrw.c
+++ b/crypto/lrw.c
@@ -150,6 +150,9 @@ static int crypt(struct blkcipher_desc *d,
 	u8 *wsrc;
 	u8 *wdst;
 
+	if (!(ctx->table.table))
+		return -ENOKEY;
+
 	err = blkcipher_walk_virt(d, w);
 	if (!(avail = w->nbytes))
 		return err;
@@ -229,6 +232,9 @@ int lrw_crypt(struct blkcipher_desc *desc, struct scatterlist *sdst,
 
 	BUG_ON(max_blks < 1);
 
+	if (!ctx->table)
+		return -ENOKEY;
+
 	blkcipher_walk_init(&walk, sdst, ssrc, nbytes);
 
 	err = blkcipher_walk_virt(desc, &walk);

      reply	other threads:[~2017-02-14 15:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-01 12:13 af_alg broken " Torsten Duwe
2017-02-03 12:05 ` Torsten Duwe
2017-02-14 15:30   ` Torsten Duwe [this message]

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=20170214153046.GB27168@lst.de \
    --to=duwe@lst.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®