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

Commit 396d34f9 authored by Harsh Jain's avatar Harsh Jain Committed by Herbert Xu
Browse files

crypto: chelsio - Fix memory leak



Fix memory leak when device does not support crypto.

Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarHarsh Jain <harsh@chelsio.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 2f47d580
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -153,16 +153,16 @@ static void *chcr_uld_add(const struct cxgb4_lld_info *lld)
{
{
	struct uld_ctx *u_ctx;
	struct uld_ctx *u_ctx;


	/* Create the device and add it in the device list */
	if (!(lld->ulp_crypto & ULP_CRYPTO_LOOKASIDE))
		return ERR_PTR(-EOPNOTSUPP);

	/* Create the device and add it in the device list */
	/* Create the device and add it in the device list */
	u_ctx = kzalloc(sizeof(*u_ctx), GFP_KERNEL);
	u_ctx = kzalloc(sizeof(*u_ctx), GFP_KERNEL);
	if (!u_ctx) {
	if (!u_ctx) {
		u_ctx = ERR_PTR(-ENOMEM);
		u_ctx = ERR_PTR(-ENOMEM);
		goto out;
		goto out;
	}
	}
	if (!(lld->ulp_crypto & ULP_CRYPTO_LOOKASIDE)) {
		u_ctx = ERR_PTR(-ENOMEM);
		goto out;
	}
	u_ctx->lldi = *lld;
	u_ctx->lldi = *lld;
out:
out:
	return u_ctx;
	return u_ctx;