From patchwork Thu Feb 27 13:35:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 230544 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC0ADC35DF1 for ; Thu, 27 Feb 2020 13:40:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 858DB246A5 for ; Thu, 27 Feb 2020 13:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582810834; bh=CA9hpk+8+vKiu9AMeZbpWkmXezxgRu0IVoffnAhetDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=z99uYk+XTn9sHp1223oFL8hxBvuclaSRGj/TDcK+dqW+qExN2H4iPVPYU4Gr2Ho7L rCTM2HH7SQ/Ieqo+ZhAXqD03RvuHpEXkjppiu6HDekGXKZUPWhQIY56OJYM0Kemis8 +9XxUkc221bHkTCbA+IGmqxlY4hlBlqqpQF9oc5A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729237AbgB0Nkd (ORCPT ); Thu, 27 Feb 2020 08:40:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:34826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729291AbgB0Nkc (ORCPT ); Thu, 27 Feb 2020 08:40:32 -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 24F5824656; Thu, 27 Feb 2020 13:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582810831; bh=CA9hpk+8+vKiu9AMeZbpWkmXezxgRu0IVoffnAhetDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f9cmdBlx4wmN4O6dzO0gJLQ4NLGEgeYtTZR0LaTC607GeUVA+WgoUPnwK/UaZrpAp ywpbelIUg80T0F28ubiC3XeCGCfNP5I1cSkW3IZdtZ7FDRH8WwIPU2VheKAe5sh7tw H4i5/084jM7QAF2TbNKgt5lcrRnOcKlr92ioPxBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenwen Wang , Tyler Hicks Subject: [PATCH 4.4 004/113] ecryptfs: fix a memory leak bug in parse_tag_1_packet() Date: Thu, 27 Feb 2020 14:35:20 +0100 Message-Id: <20200227132212.516450291@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132211.791484803@linuxfoundation.org> References: <20200227132211.791484803@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Wenwen Wang commit fe2e082f5da5b4a0a92ae32978f81507ef37ec66 upstream. In parse_tag_1_packet(), if tag 1 packet contains a key larger than ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES, no cleanup is executed, leading to a memory leak on the allocated 'auth_tok_list_item'. To fix this issue, go to the label 'out_free' to perform the cleanup work. Cc: stable@vger.kernel.org Fixes: dddfa461fc89 ("[PATCH] eCryptfs: Public key; packet management") Signed-off-by: Wenwen Wang Signed-off-by: Tyler Hicks Signed-off-by: Greg Kroah-Hartman --- fs/ecryptfs/keystore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c @@ -1280,7 +1280,7 @@ parse_tag_1_packet(struct ecryptfs_crypt printk(KERN_ERR "Enter w/ first byte != 0x%.2x\n", ECRYPTFS_TAG_1_PACKET_TYPE); rc = -EINVAL; - goto out; + goto out_free; } /* Released: wipe_auth_tok_list called in ecryptfs_parse_packet_set or * at end of function upon failure */