Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2684404imj; Mon, 11 Feb 2019 07:00:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IarmkA3BgbGpSEWnoxlRN6jm8+n+nE085DUMdKLbnWiLEkjTkEz/ABGsnRdfI1G9ug12NKw X-Received: by 2002:a62:3a01:: with SMTP id h1mr11087448pfa.169.1549897258808; Mon, 11 Feb 2019 07:00:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897258; cv=none; d=google.com; s=arc-20160816; b=tggFkKJR0dy5AReeJFW0fBnq/hVXLNjp8pq7fbZ2gyGwdaPvhObCmmUb1aQqDabxGt 3QeQv980xNRcE0z01+Zl2kLJJjLU6ZQmtgEu6AiPAVy8bGKovz5V+V4Cxf/ankDXTvKn V4vkLiWLth4AjCzw2ruyPY7W7wzllUYbJKlGQx4UWdJXUuXU7PD9+pdejBOOyd3pIk6L NzptGWlvQJMqROHpnEvPEZc5AGS86SvTcpWe1Ekhm7ZaKM9XLCakQpskhx/iCJGMEI6B Kzira1BZgPmnSuWY3yrr0B4ejMtnVvbjGYvOgOMdr19UlbNldJm2sW1Mdb96VD5SQnDW Hffw== 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=a8enr4dAn5OAwdf4j+Q4MdsHaRMi2l4M799h7x16HPU=; b=Lj5bsHrGSRsTTqUCDRTsIzZrpkwC/uxJmmope/pQOevFd6wYKgs/t+pnTo9FppIERA hx8beTTJl3K/R1AmvufhqtV0OORjgao8FMGLGFLDPNbim4jB7d3vMj6NAt56oC3a6JfC m3cuwBKJaW552IITZNsfLBSqnEnAXj2JkKrGy2HNttgNx/vAbDmt2y7ldbN1WG90Qc5F RftH+FLtSKMNMFaqwyLbXYU1kuOon0prVequF3t1FfsaCaAvrGrkrbJn7I4Pq+e6IhJE DsnGFAymvf0mudMO+9FwgkeRWQaxx0slGO5L3/M5ILeWI/GuAB9gwJHfXyYc5D4st2wJ nN9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UqdCb4hn; 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 c136si10815014pfc.141.2019.02.11.07.00.41; Mon, 11 Feb 2019 07:00:58 -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=UqdCb4hn; 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 S2389861AbfBKO7o (ORCPT + 99 others); Mon, 11 Feb 2019 09:59:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:47492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389833AbfBKO7k (ORCPT ); Mon, 11 Feb 2019 09:59:40 -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 9EDD9206BA; Mon, 11 Feb 2019 14:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897180; bh=NIc8LGoH5F8zK6hU5mL9AlPdAOaDvNdCCpYXmsnhIl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UqdCb4hnqxCE3pjTZNJ8sYNFVcXFu9Q1j1JR4I1KnjBOZpKFwYBRSsq0zl5wPyqZb V+wNELyCf4TBGVVphTlHxUG3M+dvnmxymScUGJdCFgIzfN4Xv8m/E6NVCgebXF9D/t 7XEeIZeSSVcbMD4+qzw1i7nG0uD5yfO2l4sIKrDs= 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.14 088/205] udf: Fix BUG on corrupted inode Date: Mon, 11 Feb 2019 15:18:06 +0100 Message-Id: <20190211141834.423012453@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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 8dacf4f57414..28b9d7cca29b 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