Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7276352imu; Wed, 14 Nov 2018 14:42:22 -0800 (PST) X-Google-Smtp-Source: AJdET5eFoakNnahvojeKfb2qaIbwwPDWdn/14+Edz0JN3M2xGzlSSQwG3V0xTjhTo58qvFpBorvX X-Received: by 2002:a17:902:8ec1:: with SMTP id x1-v6mr3776903plo.130.1542235342164; Wed, 14 Nov 2018 14:42:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542235342; cv=none; d=google.com; s=arc-20160816; b=GEDotLeEmt2mgfw7MsXh9kuALxQRmDwKFXwRF7Kb+imy4bWdBMp+UBw7vqfm4evDKE qyBcjYTWEZHmPiRSqDm2VVX4+JggcSFVEo2Wxu+0/5Gt0gxQvkh+ekSKy7sGstyIdefg j3puxSYqTvZK3pyJIoUe5i9qd6sT/xoHYL5m3M2+ESfrNmzUsJcpUNiON1uPbhyv5osS UiVryHHr4lq3Yk040AjRdPbEW9aPYy/dC3MJXIbxftnPiyDrSkcG5OojwhK1iO/k8jME z4DX0D5kdBPAYEJePNybHbpN4VJbSvK2Hn1/h/JlSCePLx2nqjZK9mIJn6k48Wrd50Y5 01KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=iePhX+jt0BqCYwLt6l94QCN2KGNhHRzW16/fu6faw9Y=; b=kJvxOgtXbJOtkS8cJmN3jOG8fQJCcLjpOOS+huBUaXAhbRrKTl8mpeiR2RPojaMW78 TUDevFg+kiHGEbQtwSJnBlGUR7JJoUPIZA60+lFFJPtBry4jFa/A08k8YUldYowl7NFv zohwqlJpvpLAq1t/MvwqbJOuqKESNe7nelmKhjUN4LHOSNbhX7tcG6AwtLMIfqkggc7C wOVjP63CCsAPjkVX9SYZr0EAJIW831aRJ/ufm85o5T5HBsQ+rz73QadmW94/1fQrfu+7 OFI5LFAUtWqJxIiagSF2PAYC2bKvhb6dJog6L1/1MgYBfs7vo/2S8+pGOF1r1q6+YWIf m1Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DPCVsRRn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 15-v6si27247717pfr.242.2018.11.14.14.42.07; Wed, 14 Nov 2018 14:42:22 -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; dkim=pass header.i=@kernel.org header.s=default header.b=DPCVsRRn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387742AbeKOI2j (ORCPT + 99 others); Thu, 15 Nov 2018 03:28:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:34716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729091AbeKOI11 (ORCPT ); Thu, 15 Nov 2018 03:27:27 -0500 Received: from sasha-vm.mshome.net (unknown [64.114.255.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 74A6222529; Wed, 14 Nov 2018 22:22:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542234144; bh=8NKS1UrWEz4D9RM1pP/YEroVkFrHaFuZi3QnZEcCX5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DPCVsRRn0XIvTF1VToVYqR7IQNoZh5+jJIi5U1D8iycqiMnULysdwG9CIea7kKLJM odEhlWmr7mGxkH+RPlz4DALJlo2f4+Fau6E0ae7+llzFz2bMMdBirAy7yFeIn36lPv XqO7haNdlObWq1djRcQs2yu3aSh53dJK2xrLZKzw= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vasily Averin , Theodore Ts'o , stable@kernel.org, Sasha Levin Subject: [PATCH AUTOSEL 4.19 66/73] ext4: missing !bh check in ext4_xattr_inode_write() Date: Wed, 14 Nov 2018 17:22:00 -0500 Message-Id: <20181114222207.98701-66-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181114222207.98701-1-sashal@kernel.org> References: <20181114222207.98701-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vasily Averin [ Upstream commit eb6984fa4ce2837dcb1f66720a600f31b0bb3739 ] According to Ted Ts'o ext4_getblk() called in ext4_xattr_inode_write() should not return bh = NULL The only time that bh could be NULL, then, would be in the case of something really going wrong; a programming error elsewhere (perhaps a wild pointer dereference) or I/O error causing on-disk file system corruption (although that would be highly unlikely given that we had *just* allocated the blocks and so the metadata blocks in question probably would still be in the cache). Fixes: e50e5129f384 ("ext4: xattr-in-inode support") Signed-off-by: Vasily Averin Signed-off-by: Theodore Ts'o Cc: stable@kernel.org # 4.13 Signed-off-by: Sasha Levin --- fs/ext4/xattr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index f36fc5d5b257..302725176571 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -1388,6 +1388,12 @@ retry: bh = ext4_getblk(handle, ea_inode, block, 0); if (IS_ERR(bh)) return PTR_ERR(bh); + if (!bh) { + WARN_ON_ONCE(1); + EXT4_ERROR_INODE(ea_inode, + "ext4_getblk() return bh = NULL"); + return -EFSCORRUPTED; + } ret = ext4_journal_get_write_access(handle, bh); if (ret) goto out; -- 2.17.1