From: Stephan Mueller <smueller@chronox.de>
To: herbert@gondor.apana.org.au
Cc: linux-crypto@vger.kernel.org
Subject: [PATCH] crypto: call put_page on used pages only
Date: Sat, 10 Sep 2016 13:50:09 +0200 [thread overview]
Message-ID: <49118797.WdfLSz7urc@positron.chronox.de> (raw)
In-Reply-To: <8008966.Q0OrxOpoA1@positron.chronox.de>
Hi Herbert,
This patch fixes the reported BUG reliably that I was able to
create with my (faulty) libkcapi test code.
However, I am yet unable to pinpoint the code that allocates an
SG without an associated page that would trigger the BUG.
In any case, if you approve, I would recommend that this patch
should go to 4.8 and to stable as well.
---8<---
Ensure that put_page is only invoked on pages that were used by
algif_skcipher.
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
crypto/algif_skcipher.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index d7acb73..bc36a9a 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -179,7 +179,7 @@ static void skcipher_pull_sgl(struct sock *sk, size_t used, int put)
if (sg[i].length)
return;
- if (put)
+ if (put && page_ref_count(sg_page(sg + i)))
put_page(sg_page(sg + i));
sg_assign_page(sg + i, NULL);
}
--
2.7.4
prev parent reply other threads:[~2016-09-10 11:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-08 2:23 BUG while working on algif_skcipher AIO support Stephan Mueller
2016-09-10 11:50 ` Stephan Mueller [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=49118797.WdfLSz7urc@positron.chronox.de \
--to=smueller@chronox.de \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@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