Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7148488ybi; Mon, 8 Jul 2019 15:37:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXIYZ86QpchLh8lSwMs86hwZdnfRkcdsrvaeWBJYO5YPhTGW2o7KQGJyIQ0GC7+fgVXDtY X-Received: by 2002:a63:5b1d:: with SMTP id p29mr25432491pgb.297.1562625422426; Mon, 08 Jul 2019 15:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625422; cv=none; d=google.com; s=arc-20160816; b=ouIELUaiwIog3I8joK259L19c/lwuJdhVqsJxrqsyODZys8sjjtrm9XOKPQ8y1qz2m 8gbhCgO+uCIUTWi614hOnSYS5hJcpyxUWEeSVRhgchjd577da+WUVYbesLz0hd4GiBUJ jhlcEyUghoxi3z7xLN1ILfPtk437eQiPKKkB+MNwNrMNu0xS/G19kf+0Oz13YPNbFWoU 0sHPAOf0G07eST2lh+sA7998PLxZTyepHYEVEiq33uBlqJM5HzvPXpldscoJXEgQeI2U LFwWcPOdT5zPtswR2qB1JNmsXUe8kF9YVn1+5F5/qt3UaSaHHGrGodEGdCuGbgg4PKxI SZCQ== 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=vPI23IX106jJzMHJa09ldlK00xGhwcCQHDKyDb5tX0s=; b=0syrx7bBSFxvyOaAiXQ1Wr5eKlfFpcf0oO8Zt0891vp6uqTTAapYIU0515sXYpTKq5 HalwNHWFNgsixt1rmCDCu/usITFmfcv6oRb20vqyvbH+BQx8LIy8LiChDF7y4qAs5ypK VGjSEwPYNKMVevxiilGjedNmSGYtz73gGLGg3PdC3+WvqaAcWw05qpp8lIPXh+KiK0JR kfCS8Zqmzo75BwyKV9FMvA242/kvihkWb474iuopUmoVPUWjpt5/fJx/YDGBRG4AET7V z38rD3suLpMF0CS3BLKTwGpTA24KQ0hbxOFIJbWDYxIcuz9rFeM+EKOt9lrm0JgSYY4r hCNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f6gn8eTp; 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 a17si21035875pff.195.2019.07.08.15.36.47; Mon, 08 Jul 2019 15:37:02 -0700 (PDT) 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=f6gn8eTp; 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 S1732266AbfGHPYg (ORCPT + 99 others); Mon, 8 Jul 2019 11:24:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:51690 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388349AbfGHPY0 (ORCPT ); Mon, 8 Jul 2019 11:24:26 -0400 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 1156C2175B; Mon, 8 Jul 2019 15:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599465; bh=qLjg0DWNqTJ7BN/j9P64/y3e03eUz7PUOvgBE+41BOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f6gn8eTpQH1+r/WoC7kbGcHc18w14eiWY+hBXCmGrPDtkPagF/qJWsKxYg/as8dxe BXuknRP9Hx3De6bMDRaUt/VQFaPUKImjR/1cVZuyxfh6swA6QtHwenYMW+QFr71m0W 1j6Kr3q63i1Ubde4VaWMYlNNn60Ry6mGBQ4KR7go= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Whitchurch , Herbert Xu Subject: [PATCH 4.14 25/56] crypto: cryptd - Fix skcipher instance memory leak Date: Mon, 8 Jul 2019 17:13:17 +0200 Message-Id: <20190708150521.910421953@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150514.376317156@linuxfoundation.org> References: <20190708150514.376317156@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: Vincent Whitchurch commit 1a0fad630e0b7cff38e7691b28b0517cfbb0633f upstream. cryptd_skcipher_free() fails to free the struct skcipher_instance allocated in cryptd_create_skcipher(), leading to a memory leak. This is detected by kmemleak on bootup on ARM64 platforms: unreferenced object 0xffff80003377b180 (size 1024): comm "cryptomgr_probe", pid 822, jiffies 4294894830 (age 52.760s) backtrace: kmem_cache_alloc_trace+0x270/0x2d0 cryptd_create+0x990/0x124c cryptomgr_probe+0x5c/0x1e8 kthread+0x258/0x318 ret_from_fork+0x10/0x1c Fixes: 4e0958d19bd8 ("crypto: cryptd - Add support for skcipher") Cc: Signed-off-by: Vincent Whitchurch Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- crypto/cryptd.c | 1 + 1 file changed, 1 insertion(+) --- a/crypto/cryptd.c +++ b/crypto/cryptd.c @@ -585,6 +585,7 @@ static void cryptd_skcipher_free(struct struct skcipherd_instance_ctx *ctx = skcipher_instance_ctx(inst); crypto_drop_skcipher(&ctx->spawn); + kfree(inst); } static int cryptd_create_skcipher(struct crypto_template *tmpl,