Commit 127ca125 authored by Dan Carpenter's avatar Dan Carpenter Committed by Ben Hutchings

crypto: nx - off by one bug in nx_of_update_msc()

commit e514cc0a upstream.

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: ae0222b7 ('powerpc/crypto: nx driver code supporting nx encryption')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 79c10da9
...@@ -330,7 +330,7 @@ static void nx_of_update_msc(struct device *dev, ...@@ -330,7 +330,7 @@ static void nx_of_update_msc(struct device *dev,
((bytes_so_far + sizeof(struct msc_triplet)) <= lenp) && ((bytes_so_far + sizeof(struct msc_triplet)) <= lenp) &&
i < msc->triplets; i < msc->triplets;
i++) { 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 " dev_err(dev, "unknown function code/mode "
"combo: %d/%d (ignored)\n", msc->fc, "combo: %d/%d (ignored)\n", msc->fc,
msc->mode); msc->mode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment