Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2761986imj; Mon, 11 Feb 2019 08:06:14 -0800 (PST) X-Google-Smtp-Source: AHgI3IaXoZDhnlVfRN6rDhKt5RgYI923MhgvceMyh2AK39r6/G8OmIrvQLi/qutjOWI7dOiBcNlI X-Received: by 2002:a63:ef47:: with SMTP id c7mr24021489pgk.386.1549901174215; Mon, 11 Feb 2019 08:06:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901174; cv=none; d=google.com; s=arc-20160816; b=P5n81+9hV5MZvzs/LYsmEl1PXvCpLjCryoypjsBq1mAq3gJFOPzSkycubqnhzre2LF Ck3EFYrFMhQEqu8K8S7osWEaaHYjqr62aa+AUvZ/Au6YQUmw2yfptNskGTq5fRmpUBO+ kW5m597MFS5lkhk82ooNxDbUSTDgjTnnrrFz/+fcQZtnvXygU6FWc0AGYtGhQsd184q3 +WLxE+Khs7MK3idVXBSLOZAlfk1HcZD9O5iJAbDVzk6Ce/XMhzAx70ZbUwcOFamvQ71r CivasYaAq8YNqtPeQTdSqjP8lUtbG7XDmrIaz3fPz13YMUonGGS1NnmscAvNy5h0faoa NT1w== 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=Ninez3u379SuRuulSOo/YRujACJJKRcnO+LLIT7Cvv4=; b=tDBFcXOPD2EUSDgv8qNdk2TtJ5rma4+3rTNTNT0WxOMS1p9DpDjnombeokwcTHl+hW t/jWeRmGi0u/s104kYNwD9o1tLh5pT6+n8nzci9zh62Hnu4Q5OWascDwIphXpxU562kA uZPoHDv+ZpKQiklz0TQiai9TiX0bcLgam4cq2H7IKD2Q+KRT/JB8dp/UmmqAtslFTnCB sK3H8gqRzBRaOTbC0R6bmQXaBIekQ7NhsXFmnnVj9Pe08SiULnciyEev3inFeXpqCY/J dRd16o/ixX3C/MPzZbXZ6mH3zhX8X+V364kXFtLShnK0EUXP4iF4iHErwpmCHrAiWXrP rLnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kBbTsQa3; 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 c17si10241222pgl.385.2019.02.11.08.05.46; Mon, 11 Feb 2019 08:06:14 -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=kBbTsQa3; 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 S1729852AbfBKO2Y (ORCPT + 99 others); Mon, 11 Feb 2019 09:28:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:34204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728966AbfBKO2R (ORCPT ); Mon, 11 Feb 2019 09:28:17 -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 9247E20821; Mon, 11 Feb 2019 14:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895297; bh=52xie6WsGn9BCubo4IoY3gc+/cB0iV7mZ3QvIe5vCFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kBbTsQa3q9m60GMA3EzQAaUCmpZJ21p/FlPm7D0vmiD8WZ3ePAcvgIwf7aNMsU6Qv wzguOnOIQsmyI1mARVpX+sN3Nb0/yvJcDtcNURKvB7PEBjji10AkS3/5RnKgDe4gJm tIwEj6yTl2Mx9IjL6kUdEwLpPAt42Afcy9h6+i78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anatoly Trosinenko , Jan Kara , Sasha Levin Subject: [PATCH 4.20 159/352] udf: Fix BUG on corrupted inode Date: Mon, 11 Feb 2019 15:16:26 +0100 Message-Id: <20190211141856.989360193@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit d288d95842f1503414b7eebce3773bac3390457e ] When inode is corrupted so that extent type is invalid, some functions (such as udf_truncate_extents()) will just BUG. Check that extent type is valid when loading the inode to memory. Reported-by: Anatoly Trosinenko Signed-off-by: Jan Kara Signed-off-by: Sasha Levin --- fs/udf/inode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 5df554a9f9c9..ae796e10f68b 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -1357,6 +1357,12 @@ reread: iinfo->i_alloc_type = le16_to_cpu(fe->icbTag.flags) & ICBTAG_FLAG_AD_MASK; + if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_SHORT && + iinfo->i_alloc_type != ICBTAG_FLAG_AD_LONG && + iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { + ret = -EIO; + goto out; + } iinfo->i_unique = 0; iinfo->i_lenEAttr = 0; iinfo->i_lenExtents = 0; -- 2.19.1