Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2960238imu; Mon, 19 Nov 2018 08:39:09 -0800 (PST) X-Google-Smtp-Source: AJdET5f/JeXO7d+a3Q6+QM9R71FPwo/BzsHp4jyYnA0I039A/ZxCgYXQVESbwxa52ldNdUAZ9ksH X-Received: by 2002:a63:504d:: with SMTP id q13mr21011415pgl.319.1542645549503; Mon, 19 Nov 2018 08:39:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645549; cv=none; d=google.com; s=arc-20160816; b=yqKxNtY58y21uh6a1Tiuj5IJ2nnFQGoS274t4bX7RQ1F+iSg1as1ul5IwuLB8n5v+O 2PZq23YSb6SsmnKIBY6lgj6PTnPJWkiUq+kVrXWDX6rMTazgmrkw0NPO6Zcg8gjeXq6K DdaRe8WOPG5X8Hw3UbMiVHmSZ7vjf0CIfshpBTK6kvsocqRtK4GkRarJZby0JohV7LJh z7WMQOgBbf5Dqj4fVawCekqLxSJiNhgZdTTeXV8M6wi0CyJBfBqX+L8VwM3eyaP7IC6P LkKC5rLJvTyjEl0IsDpbRqZ71ZIuIWITW3Rg9bXf4FYUaTAihN8lTAgi/Ou7csdbQ3Yx 72lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j5tdZfWE/ZARDhjo7QiOIEUOcoEnXkYhhqzUI1tEdCA=; b=SCpOb5u/MXNoiq+dt6gMN2XsM5ZEbMzZjrBDTIpJm+ItdV7bkKlHXnugOZC1G1urxY m50TMKcoaMdryBSO0udU/RAMGIKrHos9poSyXKiy16kMmRgTHLE9R8Ox2m5xQ9OMsoGx oZqYvEUNUWL8he4LzixpmweiA9AgsPivlY2oRPAows/mV8IEX9sYvsagtKdGcP3K0Cx9 LqhEBgXE019QYDTxS+1oBZ53sOe7pGQ2gxE7r5nzeEn2fc5pp56gs5D1d6cUTXBY6yik pgMohvGmnfWytHpyoYNL0B/yi8yc3MbQcViXWJLquXOLtv5I/+FTXAFvXiEKH1EP92GE 1mRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E9i9eARi; 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 n1si38272729pgq.36.2018.11.19.08.38.54; Mon, 19 Nov 2018 08:39:09 -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=E9i9eARi; 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 S1731834AbeKTDAP (ORCPT + 99 others); Mon, 19 Nov 2018 22:00:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:60008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730366AbeKTDAO (ORCPT ); Mon, 19 Nov 2018 22:00:14 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 B7A7921479; Mon, 19 Nov 2018 16:36:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645366; bh=G1z78Zn4fIg9s09kH+P2l9ZCD3XU9wgjLV9S6+cszME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E9i9eARi2g85SNWhfmI5NspQT2kQVYCw8YD8jkKNzqvq1Xs0ww5MbbOSxGBqI3wZq eZcwdyvFo87VRWUcmZZMXRqaHkxZZr1+5T2qoOT/YlEVVI2aCN16tqVgrcAA//GYRU o/ArKDV4NPOz/BTRAAt7U5tCeyiYyACzsQKHHSTE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , Theodore Tso , stable@kernel.org Subject: [PATCH 4.19 134/205] ext4: missing !bh check in ext4_xattr_inode_write() Date: Mon, 19 Nov 2018 17:27:21 +0100 Message-Id: <20181119162637.275262481@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vasily Averin commit eb6984fa4ce2837dcb1f66720a600f31b0bb3739 upstream. 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: Greg Kroah-Hartman --- fs/ext4/xattr.c | 6 ++++++ 1 file changed, 6 insertions(+) --- 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;