Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7150407ybi; Mon, 8 Jul 2019 15:39:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxq5C4fGZ97qRytnk+2dKQO/5l3cB6tqdmg8NVlSrGUmzPF2ukLP0Q9oDeFf67hwr6bQuxA X-Received: by 2002:a63:7a06:: with SMTP id v6mr26799668pgc.115.1562625575522; Mon, 08 Jul 2019 15:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625575; cv=none; d=google.com; s=arc-20160816; b=RAYu7dAplNdyy8KXuDUuzK0Fdc9WbfPLLFNfHCsAkEFoCqy/2QQGPxrA4//3mDo4QQ ZSTTFUCToTEjqUBb1nPzkshfSdE4nG5dqFhKxFiExKy5CWYvKHezBaY17Jc0tiDDU2GU p+lAScnhwcc4x2cYU9MySv3Qu4PO4ijpmPHuk2EvWrOAm4wMlHOBZXzfP+r46LC8+Q3R uJGaZH+nGaaL+RuvGrbXV75W4sb1o1DoIOBfx2Z4mdTUgUI8qSOEB5F50pySuTCakmMO jEYPA3rp1fUISikosDAJSiNvD0Dwl093tv8w5KxM1B1MN6Psy5Tpj/MQAFhBxrQjNqzb RxYg== 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=sqAynnBStbXGGJMn+JcFXNbGsVSgGRiyU2jS1we36VM=; b=JCOnJVuf755vrErwEdSVXWiOzDm8KN6Owmovvmb7bt7rpT5LKyTRgRccb9VlDYxYRA idPJ+fF2Zx1GPcCLjPnqN3epPkgS9O3agLLBxav59swoh2ccIq7cnFeXRT9w4kMasxIr Ih+YzXm1OIOjTYECovXPbe8YfJgWCQPMEdvxEw3786dN/kKExY/+SpE7pgecyhnDbjfs Ei+1nty+S8lTxjEEklhOaggmvM1Qe4uKlPW+/E9qEaocKL7QeIkzLZIzO0Z1ehNLij56 Tfrqs/6P7vzYMHBXpecCXHbWNFHletJl+dBGD4Qpg83jb/ALx5AJWvdrbyIwcuPxqHMd Uj0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MZxLz+eZ; 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 t4si19314947plq.93.2019.07.08.15.39.21; Mon, 08 Jul 2019 15:39:35 -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=MZxLz+eZ; 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 S2390293AbfGHPdK (ORCPT + 99 others); Mon, 8 Jul 2019 11:33:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:35164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390272AbfGHPdI (ORCPT ); Mon, 8 Jul 2019 11:33:08 -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 0D12B216E3; Mon, 8 Jul 2019 15:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599988; bh=YfYnE2EjNzOFpBmQyvvAYXtKa4/nrf6T7RqUEnwwf8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MZxLz+eZkGZh6xiJPM0vhh9eWdVNS1EqkEEVzFBzEuf1FrEa88mRJteXaJqu6KTM7 0touDKqohWGOWKXFpt/oeMAFcVfyUzHsrEDFzOdE28UOYghDTSk9x+rX7wyBAVxfuq suNpQ962WBFu77tLpWzIp5MOJEvQOcCIZG2FskFY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Whitchurch , Herbert Xu Subject: [PATCH 5.1 58/96] crypto: cryptd - Fix skcipher instance memory leak Date: Mon, 8 Jul 2019 17:13:30 +0200 Message-Id: <20190708150529.641082612@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150526.234572443@linuxfoundation.org> References: <20190708150526.234572443@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 @@ -586,6 +586,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,