From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227Zik2z8UhE1czoQFC/Oic+r5qrwbWoN6zPQY2ZzjAKkbO/3goyEoWvy3DBt8AnytTMmunY ARC-Seal: i=1; a=rsa-sha256; t=1517256909; cv=none; d=google.com; s=arc-20160816; b=OOqCcUEJWYHS/vhuupw2F0QPr7CEjrKG1ihnWYBupQGX4/w7tWvW/Y7ihK5+g4p6xR /Oq/3ItviA6xkPkgUKeo+yy1iPD08u0lNWDZkH0h6y9RT0XW1R21fTBC99HPpM09qUX9 FBPXnZoqvtHV65NU1LEkacCEvVAyBnp2jk53kI6txRa5YchMhHLv6dlQpda89g9F/lFA kLILIqok+cjo6AP2lAN7qb5nj1cdkZEpDnptfd++3LUdfNmr9BvTFmI0oQq8Avw4rXle HASafVZkw7+Jz1tryB8OI9Gh636UL+cjjXP0P5r6/P0s/1C3Hg8JYnzGXYfJP2w/EhKr yk/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=WuDc+DOh5baojo/M7UMBcy3Nr9C3N6sEvEHo8CTlkDQ=; b=wVOS/u8e1Gc6z+MuAWgrl3nT+mAA+E0DFeaKYsgd78pSlPAHH4aeSj1Tihka4789YK rkqCehm/Tg8yEbQP4Gj9B/yqjPGLbXXmYTVJHrs9OxHjqKK6lnNt5fKGDFjJvXSEfJYy +hBNq1jaAM1UtGH5PQBzRKbtYQ6q0XAI4j0K2BYqNDKt2C3KaBWXfsNEKYGnDTfSlVOw uH7cNIGFHEYga9qNE5PcHAYg2GmlHdZlKXYDPYYe91Ae9zBFT8jsXuNOwqItnQhG040f 7A8/H4vc9y/Cd/R/AzvfYSnrZ8S5XVMwm3iivkc/0teF3rMPhT3Zv0oXsexlF6caj0EE X/RA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590931756641199605?= X-GMAIL-MSGID: =?utf-8?q?1590959180539172261?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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)