فهرست منبع

[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: Herbert Xu <herbert@gondor.apana.org.au>
Herbert Xu 17 سال پیش
والد
کامیت
1b87887d6c
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      crypto/xcbc.c

+ 2 - 1
crypto/xcbc.c

@@ -307,7 +307,8 @@ static struct crypto_instance *xcbc_alloc(struct rtattr **tb)
 	case 16:
 	case 16:
 		break;
 		break;
 	default:
 	default:
-		return ERR_PTR(PTR_ERR(alg));
+		inst = ERR_PTR(-EINVAL);
+		goto out_put_alg;
 	}
 	}
 
 
 	inst = crypto_alloc_instance("xcbc", alg);
 	inst = crypto_alloc_instance("xcbc", alg);