Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933979AbcJUJ3U (ORCPT ); Fri, 21 Oct 2016 05:29:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47151 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934319AbcJUJV4 (ORCPT ); Fri, 21 Oct 2016 05:21:56 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biggers , Theodore Tso Subject: [PATCH 4.8 46/57] ext4: fix memory leak when symlink decryption fails Date: Fri, 21 Oct 2016 11:18:09 +0200 Message-Id: <20161021091437.551634217@linuxfoundation.org> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161021091435.435647262@linuxfoundation.org> References: <20161021091435.435647262@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 893 Lines: 36 4.8-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Biggers commit dcce7a46c6f28f41447272fb44348ead8f584573 upstream. This bug was introduced in v4.8-rc1. Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/symlink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/ext4/symlink.c +++ b/fs/ext4/symlink.c @@ -65,13 +65,12 @@ static const char *ext4_encrypted_get_li res = fscrypt_fname_alloc_buffer(inode, cstr.len, &pstr); if (res) goto errout; + paddr = pstr.name; res = fscrypt_fname_disk_to_usr(inode, 0, 0, &cstr, &pstr); if (res < 0) goto errout; - paddr = pstr.name; - /* Null-terminate the name */ if (res <= pstr.len) paddr[res] = '\0';