* [patch] crypto: nx - off by one bug in nx_of_update_msc()
@ 2016-07-15 11:09 Dan Carpenter
2016-07-18 10:23 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-07-15 11:09 UTC (permalink / raw)
To: Leonidas S. Barbosa, Kent Yoder
Cc: Paulo Flabiano Smorigo, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, Herbert Xu, David S. Miller, linux-crypto,
linuxppc-dev, kernel-janitors
The props->ap[] array is defined like this:
struct alg_props ap[NX_MAX_FC][NX_MAX_MODE][3];
So we can see that if msc->fc and msc->mode are == to NX_MAX_FC or
NX_MAX_MODE then we're off by one.
Fixes: ae0222b7289d ('powerpc/crypto: nx driver code supporting nx encryption')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c
index 0794f1c..42f0f22 100644
--- a/drivers/crypto/nx/nx.c
+++ b/drivers/crypto/nx/nx.c
@@ -392,7 +392,7 @@ static void nx_of_update_msc(struct device *dev,
((bytes_so_far + sizeof(struct msc_triplet)) <= lenp) &&
i < msc->triplets;
i++) {
- if (msc->fc > NX_MAX_FC || msc->mode > NX_MAX_MODE) {
+ if (msc->fc >= NX_MAX_FC || msc->mode >= NX_MAX_MODE) {
dev_err(dev, "unknown function code/mode "
"combo: %d/%d (ignored)\n", msc->fc,
msc->mode);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] crypto: nx - off by one bug in nx_of_update_msc()
2016-07-15 11:09 [patch] crypto: nx - off by one bug in nx_of_update_msc() Dan Carpenter
@ 2016-07-18 10:23 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2016-07-18 10:23 UTC (permalink / raw)
To: Dan Carpenter
Cc: Leonidas S. Barbosa, Kent Yoder, Paulo Flabiano Smorigo,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
David S. Miller, linux-crypto, linuxppc-dev, kernel-janitors
On Fri, Jul 15, 2016 at 02:09:13PM +0300, Dan Carpenter wrote:
> The props->ap[] array is defined like this:
>
> struct alg_props ap[NX_MAX_FC][NX_MAX_MODE][3];
>
> So we can see that if msc->fc and msc->mode are == to NX_MAX_FC or
> NX_MAX_MODE then we're off by one.
>
> Fixes: ae0222b7289d ('powerpc/crypto: nx driver code supporting nx encryption')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-18 10:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-15 11:09 [patch] crypto: nx - off by one bug in nx_of_update_msc() Dan Carpenter
2016-07-18 10:23 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).