Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1042592pxu; Fri, 16 Oct 2020 02:16:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw29WoxLQYFL3d64F0sz0IW2IyEKTRawWZfpH6i79XOhGUFyMZKUn40woV746HE/eAL+4Zr X-Received: by 2002:a17:906:b216:: with SMTP id p22mr2754394ejz.228.1602839791686; Fri, 16 Oct 2020 02:16:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602839791; cv=none; d=google.com; s=arc-20160816; b=CrYlqg3ASjIv3NrD0jQpzeXj/tNR7syfuDIfNaFiy/QVUIaVjPPnfyZp1rxQV6WBGA w7TWjijgPYt53+TfXcyFfQ9Y9PD03TWr2PZOFs1wBhvUDu/7avzT/pMWTtvT3r/ZwwRi PUXHWW8ZgZuKXbpao72F34O/QSyZx/nWE38Yhlx8f1wKeDuMZnChHdNdhwBXA5kI98Se 2LfUhqQJfb/Ei1AfLUC5HVLWUmZHb9A8O0fb3Wb1dWFkFZJFHvisE81MvaFEPmoa2gpF SF5P9s8QMwiEIwSJ0bx7hCPIMfFtTKkzs9aPq4KW4F3Bv/KkioDthkezzZYm9pbexegS oJLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YId3lgZStKZ6LZeCZ8Jcnp62x+4Fdv9OKAmjA2448XU=; b=lwLLber1PVFPHLw8n4DKaGho2FxrRCRnMc+r1rd9mXYB5v8Hx3R/i4wUjjYKmNOeZh uG3F5JMiABPaHxokhP7temN4C2sTjr+SQPTiBCXwLTIi4w2fLZVOXkq9yDBRX4ns2JNz NkQr1hMme8322vos9+iQpFbVmUqgtyGksdQPYq7l0HAZIvPAWtTD0d6Itxc9d13okjuT a4k/3yOVa1YVmTsUOdC8sR6Dq+wD+qNFfqzkskd54DHnABpEPkaiisIZ3bTnwPGm9bS6 8pyx/AOJ024di9uN5tAsNETR969Do783o6DGY4GJw8agv+b39ROL4MkBzPv84nSaj2MW 0t/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JSDB6tFw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t18si1168582eje.652.2020.10.16.02.16.09; Fri, 16 Oct 2020 02:16:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JSDB6tFw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395009AbgJPJOK (ORCPT + 99 others); Fri, 16 Oct 2020 05:14:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:40744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405796AbgJPJLO (ORCPT ); Fri, 16 Oct 2020 05:11:14 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 431A020789; Fri, 16 Oct 2020 09:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839466; bh=JDYK2fvaEMqe0ctZcXUeHNpGFMH5xFt6jfhJEhdIJms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JSDB6tFw686nUEcb5AVHMA2VtKoDlqQv2W/CNe6M3SgABH64NYhs6IZT9nLTjtdcn WHKa1T3YBCG8NgQVYydXXfl1/RL/ubgKLqCnlb3J5455FeHb5OOe182xDLWQpIP5mI 2+69Uzr67nttywP2PNHdB3rLlUzOZycU2X4bf+HU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+9b33c9b118d77ff59b6f@syzkaller.appspotmail.com, Jan Kara Subject: [PATCH 5.8 14/14] reiserfs: Fix oops during mount Date: Fri, 16 Oct 2020 11:07:59 +0200 Message-Id: <20201016090437.856364597@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090437.153175229@linuxfoundation.org> References: <20201016090437.153175229@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Kara commit c2bb80b8bdd04dfe32364b78b61b6a47f717af52 upstream. With suitably crafted reiserfs image and mount command reiserfs will crash when trying to verify that XATTR_ROOT directory can be looked up in / as that recurses back to xattr code like: xattr_lookup+0x24/0x280 fs/reiserfs/xattr.c:395 reiserfs_xattr_get+0x89/0x540 fs/reiserfs/xattr.c:677 reiserfs_get_acl+0x63/0x690 fs/reiserfs/xattr_acl.c:209 get_acl+0x152/0x2e0 fs/posix_acl.c:141 check_acl fs/namei.c:277 [inline] acl_permission_check fs/namei.c:309 [inline] generic_permission+0x2ba/0x550 fs/namei.c:353 do_inode_permission fs/namei.c:398 [inline] inode_permission+0x234/0x4a0 fs/namei.c:463 lookup_one_len+0xa6/0x200 fs/namei.c:2557 reiserfs_lookup_privroot+0x85/0x1e0 fs/reiserfs/xattr.c:972 reiserfs_fill_super+0x2b51/0x3240 fs/reiserfs/super.c:2176 mount_bdev+0x24f/0x360 fs/super.c:1417 Fix the problem by bailing from reiserfs_xattr_get() when xattrs are not yet initialized. CC: stable@vger.kernel.org Reported-by: syzbot+9b33c9b118d77ff59b6f@syzkaller.appspotmail.com Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/reiserfs/xattr.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c @@ -674,6 +674,13 @@ reiserfs_xattr_get(struct inode *inode, if (get_inode_sd_version(inode) == STAT_DATA_V1) return -EOPNOTSUPP; + /* + * priv_root needn't be initialized during mount so allow initial + * lookups to succeed. + */ + if (!REISERFS_SB(inode->i_sb)->priv_root) + return 0; + dentry = xattr_lookup(inode, name, XATTR_REPLACE); if (IS_ERR(dentry)) { err = PTR_ERR(dentry);