Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp464777ybl; Tue, 28 Jan 2020 06:23:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxWAzxUeHhSQopUBtmFPFbs5S5vx01lCzcNG83S4RqBnQyuIal3uwFQUdAFGltV4NzMwqQR X-Received: by 2002:a9d:7757:: with SMTP id t23mr17094375otl.315.1580221398848; Tue, 28 Jan 2020 06:23:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221398; cv=none; d=google.com; s=arc-20160816; b=AY0gfv+CrYejsxlZVeWvTuVTZsw7psNgiL6k+oPeGMaFZ+oDH3EZrvAc/5vRdQo0hi HYF0QvkqIaFK/48ht9OIm2UGShuMyVFusbLxsv8X3LiXAiefkJNzzSY5k2M/t9OQoPyD WHZ1js+ZD016dGWeMmZ4NapCy911OJWgV0MAjgWvXSM3/++b9TCUdCKdwPTkpEZBKu0E 1VZSbO+LMzeEGTUeFbF805Dkvf44sH92gBstuiQRDbEArOLSlKG6IZysQaUVF1UEXPvy fXpAXlaGHb3LMR8F+6d/z4XLgc/7w7Or7IxdJfvW56qk29gh1pO9LQSq4aaoS6275Pce W9jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ehjE22E3l15kfvmhkGrj3b1jr+ZNK4PGk5EhUqa+3gA=; b=Tttn/PM7dkEoiQ0X8gJTx1D1NYcKrus8enh1zYWJpyunVuq74E7HoH9vtWG3HlVFda /NtEQG8p/MDRPI7rS6MqJf0PFjSvxE5NwmEydM4e2a8LvRQc+dnh+hiPBQB38Wj/Z3HV iumHpxKktQQrFUdVa1Se3SBjUz2lovT9A+0u8HrombF64OhFdoEvdfXZxfPq382j1KV/ uc1GckUvXL489u+70lPO3Xkx9voYrIbypy7JT8ow+bkmtYqNnQ3zGeR+YPuXEkV50XW7 s3jRsr/YLR+YKdV2j41yCh+CiDM+upNDxht/z1bS5BMcQr0amYt0zjD5a41eAfR4mlpx csWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Hvph4Lnv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p83si5202721oih.198.2020.01.28.06.23.07; Tue, 28 Jan 2020 06:23:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Hvph4Lnv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731495AbgA1OWI (ORCPT + 99 others); Tue, 28 Jan 2020 09:22:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:47756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730349AbgA1OWG (ORCPT ); Tue, 28 Jan 2020 09:22:06 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6609624696; Tue, 28 Jan 2020 14:22:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221325; bh=dh2i587zdnnXchzuqp6Q+w7nspJszCKKud0jJOZMldg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hvph4LnvLckhCUKazP1bd+xucwlldZhgeMkIKA7i+7GNdHuFqPi6OZ6lRkjLjtSOi /Uy4fNi84b/TPRl/KFXyOA0zFHg8vyc4PEvxdOze5jCwOHALcCy0Vtj1oNRgApdHM4 GtzX3rFh3KUe3gbu0lP5sYPA4He1JCawQJwOLyLw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Iuliana Prodan , Horia Geanta , Herbert Xu , Sasha Levin Subject: [PATCH 4.9 178/271] crypto: caam - free resources in case caam_rng registration failed Date: Tue, 28 Jan 2020 15:05:27 +0100 Message-Id: <20200128135905.793901133@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Iuliana Prodan [ Upstream commit c59a1d41672a89b5cac49db1a472ff889e35a2d2 ] Check the return value of the hardware registration for caam_rng and free resources in case of failure. Fixes: e24f7c9e87d4 ("crypto: caam - hwrng support") Signed-off-by: Iuliana Prodan Reviewed-by: Horia Geanta Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/caam/caamrng.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index 9b92af2c72412..a77319bf221d8 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -361,7 +361,10 @@ static int __init caam_rng_init(void) goto free_rng_ctx; dev_info(dev, "registering rng-caam\n"); - return hwrng_register(&caam_rng); + + err = hwrng_register(&caam_rng); + if (!err) + return err; free_rng_ctx: kfree(rng_ctx); -- 2.20.1