Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f984f62a authored by Herbert Xu's avatar Herbert Xu Committed by Kishor PK
Browse files

crypto: algif_skcipher - Load TX SG list after waiting

We need to load the TX SG list in sendmsg(2) after waiting for
incoming data, not before.

connoro@google.com: backport to 3.18,where the relevant logic is
located in skcipher_recvmsg() rather than skcipher_recvmsg_sync()

Change-Id: I4e18b385fe50c844cd62a2eb20122036ea4dfe09
Git-commit: 36c84b22
Git-repo: https://android.googlesource.com/kernel/common.git


Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Tested-by: default avatarDmitry Vyukov <dvyukov@google.com>
Signed-off-by: default avatarConnor O'Brien <connoro@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKishor PK <kpbhat@codeaurora.org>
parent a862d7fe
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -446,12 +446,6 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock,
		char __user *from = iov->iov_base;

		while (seglen) {
			sgl = list_first_entry(&ctx->tsgl,
					       struct skcipher_sg_list, list);
			sg = sgl->sg;

			while (!sg->length)
				sg++;

			used = ctx->used;
			if (!used) {
@@ -473,6 +467,12 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock,
			err = -EINVAL;
			if (!used)
				goto free;
			sgl = list_first_entry(&ctx->tsgl,
						struct skcipher_sg_list, list);
			sg = sgl->sg;

			while (!sg->length)
				sg++;

			ablkcipher_request_set_crypt(&ctx->req, sg,
						     ctx->rsgl.sg, used,