]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - crypto/algif_skcipher.c
crypto: algif_skcipher - Fixed blocking recvmsg
[karo-tx-linux.git] / crypto / algif_skcipher.c
index 34389964000d73479214b647bfeee68406671929..f80e652ef0d02fed11d206ef2ed189c804ada7d6 100644 (file)
@@ -448,14 +448,13 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock,
                        while (!sg->length)
                                sg++;
 
-                       used = ctx->used;
-                       if (!used) {
+                       if (!ctx->used) {
                                err = skcipher_wait_for_data(sk, flags);
                                if (err)
                                        goto unlock;
                        }
 
-                       used = min_t(unsigned long, used, seglen);
+                       used = min_t(unsigned long, ctx->used, seglen);
 
                        used = af_alg_make_sg(&ctx->rsgl, from, used, 1);
                        err = used;