Received: by 10.223.176.5 with SMTP id f5csp3394931wra; Mon, 29 Jan 2018 12:33:33 -0800 (PST) X-Google-Smtp-Source: AH8x224ZeF6buOIavs8PmoxPE9aORe7G/Io+RL0+0463ZxAMP5hMqStZs9dk0FXaGeHgwAA5TqFP X-Received: by 2002:a17:902:328:: with SMTP id 37-v6mr16269450pld.398.1517258013077; Mon, 29 Jan 2018 12:33:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517258013; cv=none; d=google.com; s=arc-20160816; b=if6QZ5Uk7BR8Gv8Xy+e6hMnZVBWG1pyb75SJWtivWS/6qAx0L+Nyc5d9jVhtAo4bpU wbZ9gvmbVc325AD+N9hV3VmBA1mrklL1sfoY+hwZBT9+UA5y0P8ebHvPJFhtdqBUCZzf xKBmJSvG2OEviYTecVt7UpMpXoy+pGuIr4WPlIi99uo/WIlQje0fEtUBtgjXyAAvEktk LyNsbDL8Ngdqwp5NV2Ju/q95/P42YTuraIRmujxOs0N0LbvTcht0mlHi9Pq48hvJJLID i3wOE6j85Z2fUrU0XbM3ewzbCSNn/HoMxCFvN0N0jtzdwjxNjErJ8TBfBUaiV4d8vLvy ElsA== 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=p6hI8d3gQo4HjMQ77ZGs7gB0p/JvD/uCK7SoQ3y958s=; b=CFlfGTdRBQYJlFJEFOmKPP5Clyph9BPWbTo247O9/yPB36MUn+VrjPqrbpEN9R8tgJ 4BLs1VNwqOCMrFGbcLlJs/1Y1tnZ77UjZA3TahJ8mawa367HDqexuI9Evv8D0J36hRX9 6bsLMkTiakOu3E6jlwkV9tntZ/XkrrJ8D0n315TKjYa+jFFcg0uYneZSWTUD0u6PYj01 bZPoZM85wu8KidNLpxWUEGTuVp/FPudw6YXVtbE2LN3Fow4XcfcqDUlF7atxV054jUsV e3tHBoPIidZtoEULphKRZ5doazEiuMKQxpD3PUQFUfbOfX9eSrSf8EbwzdK3UPkbdh7C Z2cA== 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 z100-v6si418742plh.752.2018.01.29.12.33.18; Mon, 29 Jan 2018 12:33:33 -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 S1754552AbeA2Ubr (ORCPT + 99 others); Mon, 29 Jan 2018 15:31:47 -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 S932313AbeA2UPJ (ORCPT ); Mon, 29 Jan 2018 15:15:09 -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 253062F13; Mon, 29 Jan 2018 13:02:24 +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.4 43/74] reiserfs: dont preallocate blocks for extended attributes Date: Mon, 29 Jan 2018 13:56:48 +0100 Message-Id: <20180129123849.521296639@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123847.507563674@linuxfoundation.org> References: <20180129123847.507563674@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.4-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)