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

Commit 1b87887d authored by Herbert Xu's avatar Herbert Xu
Browse files

[CRYPTO] xcbc: Fix algorithm leak when block size check fails



When the underlying algorithm has a block size other than 16 we abort
without freeing it.  In fact, we try to return the algorithm itself
as an error!

This patch plugs the leak and makes it return -EINVAL instead.

Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 2a999a3a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -307,7 +307,8 @@ static struct crypto_instance *xcbc_alloc(struct rtattr **tb)
	case 16:
		break;
	default:
		return ERR_PTR(PTR_ERR(alg));
		inst = ERR_PTR(-EINVAL);
		goto out_put_alg;
	}

	inst = crypto_alloc_instance("xcbc", alg);