Received: by 10.223.176.5 with SMTP id f5csp3393535wra; Mon, 29 Jan 2018 12:32:23 -0800 (PST) X-Google-Smtp-Source: AH8x224BbdQ5G0cHolr0rweYA3Zkhd1ZaXTIaMWrxNIZZ5B2LA+/la6GSUGSM1pUq5bGqQLEju40 X-Received: by 10.101.101.144 with SMTP id u16mr21782070pgv.73.1517257943171; Mon, 29 Jan 2018 12:32:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517257943; cv=none; d=google.com; s=arc-20160816; b=foV0ZuXYTAN3LEBRyljCZnkHi66II96qWB/22FoQecDb0L8IpN50zSViRrzBKNYbQ1 RWRsQfH9xfnb2YENyZi5MK+HVxezPF5MJPA9CwjjntgOYag7PMKFO+oM6Mj3l+6eKPhZ LJ9ZXBtzllo7DQQ43uQoNY3KJGaYmrbIW1h9/99EGv6P5CDyqHWqbP5FfnieSHZEbbla XOl28dAx2xc474HptKNiZeKFvEbyEW2VaBOXWnTNi3RKXZWItgojEXMHjMX+o1e8vyjx KvzmToA4IpGpQtywXniOAxht7tOlKfqhM6UTO2fEslt/SJ2gh0Klu3iBPYvVatYqRdua sxhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=WuDc+DOh5baojo/M7UMBcy3Nr9C3N6sEvEHo8CTlkDQ=; b=ZDq3W+bzsvEHAp5p2d+ACav9onJHGzcmN/rvQl8xRiwgoEhZbuHRZfqALKzPJcKQda L6+c79T9bhaYa2xOAfn062dK2dMNZ2yasr3ZdkxF4pKm6r/uD7sBZJsvejH8mBGsl2kk Zlqy0gjruIMAKkCnJhHxA82R6dzBSGftfC6OEDyK/0mgTcZWzXmPCDxI5z72AYHXeigl gComG+RtlgUhyeC8+CFpoTo6USDjDAYnrtpN7uZe+kJ+J/tTv2WlpCS7avrBDnGOnoAW 5dzoVpPHw06OEKRXiAAjkPI2pUBTcUE/48YTfRo8j6QNyGGRd8PrcrMmsiXN6h1OMKou Ch1w== ARC-Authentication-Results: i=1; mx.google.com; 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 z6-v6si9809488plo.200.2018.01.29.12.32.08; Mon, 29 Jan 2018 12:32:23 -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; 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 S932342AbeA2UPK (ORCPT + 99 others); Mon, 29 Jan 2018 15:15:10 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:42090 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932153AbeA2UPI (ORCPT ); Mon, 29 Jan 2018 15:15:08 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 268082F77; Mon, 29 Jan 2018 13:05:04 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Mahoney , Jan Kara Subject: [PATCH 4.9 23/66] reiserfs: dont preallocate blocks for extended attributes Date: Mon, 29 Jan 2018 13:56:47 +0100 Message-Id: <20180129123841.041393995@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123839.842860149@linuxfoundation.org> References: <20180129123839.842860149@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jeff Mahoney commit 54930dfeb46e978b447af0fb8ab4e181c1bf9d7a upstream. Most extended attributes will fit in a single block. More importantly, we drop the reference to the inode while holding the transaction open so the preallocated blocks aren't released. As a result, the inode may be evicted before it's removed from the transaction's prealloc list which can cause memory corruption. Signed-off-by: Jeff Mahoney Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/reiserfs/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c @@ -1136,7 +1136,7 @@ static int determine_prealloc_size(reise hint->prealloc_size = 0; if (!hint->formatted_node && hint->preallocate) { - if (S_ISREG(hint->inode->i_mode) + if (S_ISREG(hint->inode->i_mode) && !IS_PRIVATE(hint->inode) && hint->inode->i_size >= REISERFS_SB(hint->th->t_super)->s_alloc_options. preallocmin * hint->inode->i_sb->s_blocksize)