Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7149943ybi; Mon, 8 Jul 2019 15:38:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmno0ViprT/lVXty0f/SvNH4q41nj8I9G+zItEgztC3/5E+G2z1tECG22rZ2oQ42nRff04 X-Received: by 2002:a17:90a:23ce:: with SMTP id g72mr28742217pje.77.1562625535873; Mon, 08 Jul 2019 15:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625535; cv=none; d=google.com; s=arc-20160816; b=m3WEydJdu9X0Y2rs1YFATZfi/wC5KeOTVo9B1LRB1zqTFYwxGqPj3uRfcSrNUbx34J rW4hX63UWs9GQPYHVP5uEsb4v9mTXCreRFtM52e5K2thpnFSsr0cp5AQX+kfRIV6pR1T auLLeGyog5cKheGKTGZkUKmuq3JvrIjNsiqIjWUUQeFcrgqk9CuIOh9MWWjpYrAZBnG6 U0H1JZ2+oXSvcgQe54JmcXI0zcqEDnkd9i0ZzanRY0qwLqd3fVVLqHgNcPeKprqaNu+Z JfFI+QSDZTX+BYy06woVD8UJj6K9ZARE8nqxtdHtQY+U/zpsAtRCRFpUgrPZOduwvYYs Oehw== 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=TvdB4sZrpd+tVfEkU1M5NFE7wUsD/53K+Co7PgA9JJJpUXXweHK5liy9XXUvQTRmA8 03aehP4TpzfvBIYqNEIJvb/p4xA567+kpCkNQ0Q29eMGnbuWi4lzzv4s44nYiBBIsDRe i0o09B56rvZcsgFNRMfLe1Z9CUS8hv9QRi10Yfps7Ytb+bquF9+4jQBoSmWy5Z7J7Cri BL0EMeRZSjTZe3qTtBJ6T0xhwceJsZRmZ/rdRiX4fUS7UcRhsu4nX7dESFaAO2QW9xft 0sEq2MpLwmraks2spAVhQECpspBvt/vuqFjqAUKNgrh63rh9n9WsP2LDUy/u6Xf5qEXy uuCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="R+sRL/Q+"; 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 o1si19460800pld.278.2019.07.08.15.38.40; Mon, 08 Jul 2019 15:38:55 -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="R+sRL/Q+"; 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 S2388086AbfGHPaI (ORCPT + 99 others); Mon, 8 Jul 2019 11:30:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:58712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389716AbfGHP3u (ORCPT ); Mon, 8 Jul 2019 11:29:50 -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 43F8D204EC; Mon, 8 Jul 2019 15:29:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599789; bh=YfYnE2EjNzOFpBmQyvvAYXtKa4/nrf6T7RqUEnwwf8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R+sRL/Q+bt7DCG8L2FZioQMLe+JWZQdlOyiUXk4Ot/iUUhmhRJfeqs0LXGtN0iOjj TT+gV+ilhkEz2HUV0fMLFRsI/DQ4o1Ix2KKsDrcNcj9ayZX4Qj98m60frGlJnVenPD BcLTnfnQ4pCc1AOKq4NsANCtUAvGhDHDGdot/dec= 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.19 43/90] crypto: cryptd - Fix skcipher instance memory leak Date: Mon, 8 Jul 2019 17:13:10 +0200 Message-Id: <20190708150524.730642298@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150521.829733162@linuxfoundation.org> References: <20190708150521.829733162@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,