Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2961174imu; Mon, 19 Nov 2018 08:39:59 -0800 (PST) X-Google-Smtp-Source: AJdET5cRRxu6HnhBRu61c0YxZWNrxjf/IgOe/1OuCXZI8hDCUWWwQEx68sjNRsTXu/721ldlky2/ X-Received: by 2002:a65:5286:: with SMTP id y6mr20644049pgp.439.1542645598992; Mon, 19 Nov 2018 08:39:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645598; cv=none; d=google.com; s=arc-20160816; b=Pwi1NBJISnWdEOXowEOgJcYa1nWKXmSoOJvuu7gfaD/O6H7jruOke3ZPWcJd4ZVyr4 aOnTeKaiMy5aycYChze3VmeF6ZFvXWFZnrLzQJIG7r8aQgcAEvbyR+9gyrqqVpjAj0SW mOg0p/bHo4AGdn9YuJlecUUcpV9jtKJ0YGwdyDMYyTHMt/eXpEwiS2JcwXWmIgQyhFkb Gx/J8ngGWjUrTeUxbDz/bPGQPDLJeRYRNb5gyKtI28/tn1tDODSvdaoIy0oqHtWqZ+2F WEm5R//rE9W8/xlCxCz3/h8b2v6XNnx3HnqfIChdxG5u5zDvg9YyxRDWbf6i5i+QhiYg +fgw== 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=de51UE4cR4FOODdeuEIddb9Jit5YNxexPbgQO/YI6XU=; b=KiBXDZYeJdCVqWa3NQBbCA1hBkd7m+OnH53xvdGq6OqXVWFf4xqsCXD2QhxouxpuQV Xnl0lc0dPPUKJ0UNAv03Iw4vG9YSNQi8SAKUKtIGEJODyYdskEQWdLonVgatAH5ffHVj T0Tn2F2NYH9Asr7aM33vW1Qnv+9t5hR3oo3l3qMCFgbTZUhuEQJ5WMREblyiQ8QOYQcw BW/b8mdgn6UdIdnmiJQq3E+5T2Oht6M14Ze80L0T6OFUIvDQHBjmTLwEwdseCCneVUZh T2sGI/qupO4dEr0n1xvcwBlRm6ydpDiYlm4sCUZVwxiv+x9bWT0sCZ7WKmX3CKJgETGC 7dbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B9fJsaV1; 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 19si37120585pgq.215.2018.11.19.08.39.43; Mon, 19 Nov 2018 08:39:58 -0800 (PST) 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=B9fJsaV1; 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 S1732157AbeKTDB1 (ORCPT + 99 others); Mon, 19 Nov 2018 22:01:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:33346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730931AbeKTDB0 (ORCPT ); Mon, 19 Nov 2018 22:01:26 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 8940D2086A; Mon, 19 Nov 2018 16:37:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645438; bh=qd8xSr4Nv2RmFy1U8jd8Byv+nR74PJfsKm7NUpxKjFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B9fJsaV1UCQFrHV6CZCsevYrxlF0QqYhXyZHqHCfbBpJtX+zExognKB4oC3On7zZ6 dccDLfQ1OblttQd3lAlZ5D4dShOSRdEv0c9GBFnm4PpAHPkBHgAilgiIiFSbo8NuKU EMABT1eBMOUViMsZjs/zj7ZeMx4bAv/pLXLfLZrY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , Theodore Tso , stable@kernel.org Subject: [PATCH 4.19 145/205] ext4: fix buffer leak in ext4_expand_extra_isize_ea() on error path Date: Mon, 19 Nov 2018 17:27:32 +0100 Message-Id: <20181119162638.198301272@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vasily Averin commit 53692ec074d00589c2cf1d6d17ca76ad0adce6ec upstream. Fixes: de05ca852679 ("ext4: move call to ext4_error() into ...") Signed-off-by: Vasily Averin Signed-off-by: Theodore Ts'o Cc: stable@kernel.org # 4.17 Signed-off-by: Greg Kroah-Hartman --- fs/ext4/xattr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2708,7 +2708,6 @@ int ext4_expand_extra_isize_ea(struct in struct ext4_inode *raw_inode, handle_t *handle) { struct ext4_xattr_ibody_header *header; - struct buffer_head *bh; struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); static unsigned int mnt_count; size_t min_offs; @@ -2749,13 +2748,17 @@ retry: * EA block can hold new_extra_isize bytes. */ if (EXT4_I(inode)->i_file_acl) { + struct buffer_head *bh; + bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); error = -EIO; if (!bh) goto cleanup; error = ext4_xattr_check_block(inode, bh); - if (error) + if (error) { + brelse(bh); goto cleanup; + } base = BHDR(bh); end = bh->b_data + bh->b_size; min_offs = end - base;