Received: by 10.223.176.5 with SMTP id f5csp2839557wra; Mon, 29 Jan 2018 05:00:04 -0800 (PST) X-Google-Smtp-Source: AH8x224yxc6cDnQGtaKpWSYhtDtyh+vU3NhdDVzv3IYztGMkLmbT+tx9nSdMP69VOH//i+QfLbpn X-Received: by 10.99.144.76 with SMTP id a73mr21245899pge.376.1517230804040; Mon, 29 Jan 2018 05:00:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517230804; cv=none; d=google.com; s=arc-20160816; b=IVgADamY5mZJ7AzMvZbA3ka4Qwv/NkBR6/v40wh4gKOqrCjIYs7ylFF23ADgqI9s56 Hz91ljSOym/07neqkmiWhzUiVMwb83NGvpwbxjLGMZZE+qGOomdTWz5SZ+G74KCo+zz7 ajVHo7aiToASqPdhMdxvUJMhgpzMEr11Xj4LWgBWd/BO4d8+E/PSVo/DsCu5k6YqcTNK O+zSrZ9utrWE3VVQ+kiqf6dRjEPlDQGSfn7PqjN5P7WnFbVO0if6p2/zTwPnkLv4C7Pz ZDJVN0WM52HknTvsyunSW6hPeXQK0pFd6hJfk/GXu1onmmCVDfMvOuEGcB08UrKjtDFk nK1g== 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=eXVIiT2WEXtoh7zYHXHrHIz/dZFFDzW1ng5P+5ATPMg=; b=ofGlXPkG5KpLLaYFct3tEqY9HmyrPNTDdviYT7fTDuORxolEJ9HueBvhakGOLjf/O4 QQ8VkSp6z8lgC1VN21nPGocwHv3ueGaA2NCpAmgpXP+h+aRtxr8SRscn8ojiHCer6JG5 bZk0l+9DA8nYxdmq0ojGYxQBHJv+DTwYgG/cR3Jz0MBxU2uu1OHTcrI23BGey1DGzAfc vxpA2yhg/Itk7KKNscXCOOABzMUCSbjUIp+4YrYxKowJfHQ/9rJNHnPZsREjoVgu8Y6f 0NQqOaRxOjZ+KB3T3Hs0vkMjQGzNyXvl77ZiM+xfC1NyuLb9S5bn6Er+ZphWVUQ1wg0o 8yAA== 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 a9-v6si9393958plm.287.2018.01.29.04.59.49; Mon, 29 Jan 2018 05:00:04 -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 S1751801AbeA2M7Y (ORCPT + 99 others); Mon, 29 Jan 2018 07:59:24 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41986 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751374AbeA2M7W (ORCPT ); Mon, 29 Jan 2018 07:59:22 -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 4BC372EA9; Mon, 29 Jan 2018 12:59:13 +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 3.18 33/52] reiserfs: dont preallocate blocks for extended attributes Date: Mon, 29 Jan 2018 13:56:51 +0100 Message-Id: <20180129123629.642103647@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123628.168904217@linuxfoundation.org> References: <20180129123628.168904217@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 3.18-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)