Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1163854pxu; Fri, 16 Oct 2020 05:38:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqfYCB8pbUm6QUxNAPBcm6ZrSK4NEiMHW8idrIAGoZ6y6K/f5hgW70kyjt/Viky/D6KhP+ X-Received: by 2002:aa7:cad6:: with SMTP id l22mr3631472edt.229.1602851922598; Fri, 16 Oct 2020 05:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602851922; cv=none; d=google.com; s=arc-20160816; b=YV2UePuJ7qSekSvvO+dVHDEqKP2Z3RSVXuHoYUMv/OBLBp2RctAGFWPXTKwVgC5TUe BNNeYVmTnG9NCMEmi7M6r8BVNDn/fGqgaRVM4HIFdg7j2KhGigVPVEFppOhNRpuYd1eI VcKsGsC4psfyK6r/fbrkyG1UHhzWIw7dPW3kE0xnKWOCiZdC7mPGO55cWGgoO/ahaiSp N1CiA0bww29LgwahSsdVI+7Lc2mvhGfkrWUdy0a5aQ1ORc8FrUJhO+pqvm2pyE7Hzo7h IwL5Ft5oxQrtero87kUPfSN3T6ATfNndmLmGQSZcF3Cq/29gVxlpt5dHitwHDQ/sdpIZ SNkQ== 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=E5qhRcXp/1JzYewdEpjTAbXivEro5oMHyzy2IzLFb10=; b=LebiGowCOoTcHbmU15iWYn2HiM4aw2EQC4Wka9t9I4q0ySIKXkI+bRmzf8fy7583jy UCVWmf0/2g2/SzLo88HHdkR5a1Z4J26nmAU4YMFrVHDhdlCrMbG/HVboG9B+cngR287K 9P5MXWiaUvKp11fzLFuDILzUSBdUxxaJEotKxNgg+iJNY3JigvFpsIk8vY2HVOKHFaYx lJ9iCobWz974eyKklpUiD0r5SQbDNTLNb8pQaGznjvxKXGHT2Ryj8a9bI73eYlHls/Mo HO2Ln3ZLT///oouOHu2Uw9bEwC05tjfYy4in1/z/u5nBZ2OVnD76gpfeGxxgJR9YjiGC dmFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fCzlJ5W+; 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 t23si1612422ejy.718.2020.10.16.05.38.20; Fri, 16 Oct 2020 05:38:42 -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=fCzlJ5W+; 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 S2405626AbgJPJKD (ORCPT + 99 others); Fri, 16 Oct 2020 05:10:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:38850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394998AbgJPJJx (ORCPT ); Fri, 16 Oct 2020 05:09:53 -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 EF8FD21527; Fri, 16 Oct 2020 09:09:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839383; bh=fVvVSlX1NflFRITbbllodyVJEz+j1pa0M5tf1dmctAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fCzlJ5W+QqUuPVSGSdREXUO4Nn0E5Nbxy+FmFHUeNjZmY290BpVi4x0hF1O8BRSOz ANy5JykoQv0XHM+NxAy3Tud1Xfj8yN6bBDUqa0yIHxlq4n0wH653UcvBxaxuYeHsXS /CqX3JpNGXj5glcDzcd30suMjSBZzfifEwo5PP6M= 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 4.19 18/21] reiserfs: Fix oops during mount Date: Fri, 16 Oct 2020 11:07:37 +0200 Message-Id: <20201016090438.181624388@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090437.301376476@linuxfoundation.org> References: <20201016090437.301376476@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 @@ -665,6 +665,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);