Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3703527imu; Mon, 28 Jan 2019 09:18:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN4tbo7x5Zduq2Y+WLhrAoFdlOa01NDBNC72EKlnaoXrQBPlpQNzVbpjanALgO0dTVDlIIXq X-Received: by 2002:a62:7e13:: with SMTP id z19mr22604766pfc.94.1548695924067; Mon, 28 Jan 2019 09:18:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695924; cv=none; d=google.com; s=arc-20160816; b=tI+Zqj1aklnX+21uOphotdgSrO8uhs2JUnbdlI3k52hQsz6kZdK3AT98vifunDgx5+ VjOVMCu0WnjEfW2uhJ4kXaCQhzWqWta5YjyMH3gFa7J2juN2fDvDWRh6t0o0F7TJLclc KZGUj/esg6nBVHqfPBzuhjjfeLOj2H7rOW+qWR1QWrw0IvpS5l4OyZD5FUTsaIsIHTRl S0XfDYGDENWcqrp20ryToNB2MikOUHvWy3Y7QF62X/qa5WaVB4Xw+0CF1stcWR8gCY2n T3tQwJGvwEXtWRzFqBfqX3PEcxFe7D6Q3WenpRGjgY/UX+iqlYmas0HeVf4TRGml8LlS lIXQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6xXgqKzBOic0D6inpRK/YC7rTNKaenQchgFKr/R5Zg0=; b=ree7jE4IOIx6Naux65DvLZ2QofHRgtVmTWlq29+f58aCUndKVDhvCV1CSfpO3zrFhN 0n/Ir6Yh9duSTB75uG1pllqkcIdUfQnHkXJZ4B5vJ7+AgRXgxb2aMfAOztdlwHzYw0Rw VkJlhtNkaO0Y2lRhuOaYzSvkxtrKnvUfPUXVlPd7WNU/Xwjukb+oIfP6xBHJMDs0vKiN Qli0XxLgHZXmkACptkPWxpTRe97WGrpDmUMJwYcRxjbjq40Od9kjRiaI++Zwtc3jSNKB OJQ2BIgqoJ2doeF2YqHjvtdYWLzZ81pIeKl/9r4mCtqQBrvjQ2pWJ4DLhwd4hLHHslIh /HVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ntjk4vK8; 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 x24si32400424plr.379.2019.01.28.09.18.28; Mon, 28 Jan 2019 09:18:44 -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=Ntjk4vK8; 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 S1732208AbfA1RQv (ORCPT + 99 others); Mon, 28 Jan 2019 12:16:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:54250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731953AbfA1QGG (ORCPT ); Mon, 28 Jan 2019 11:06:06 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (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 411CB20989; Mon, 28 Jan 2019 16:06:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691566; bh=Fm1ieG9fOKAaOC8aCnyz6A56V6F3IfFHWj0N/DvNJNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ntjk4vK8WgO2NWa/PgtV6q8P3xz6f2sh4eH7BbKxMELETk28945eqTdy5F0zKXygl T3JW+Ib+Z5+nRSAdgpnwDx0kkYvRXcSCL10wsPfp6XL9Xflph+m07q1jpEUBwc1NVw 9QHULyem2+oysdRpcF6aEgsOsQqN58JGD8v4/xn8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jan Kara , Sasha Levin Subject: [PATCH AUTOSEL 4.19 144/258] udf: Fix BUG on corrupted inode Date: Mon, 28 Jan 2019 10:57:30 -0500 Message-Id: <20190128155924.51521-144-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Kara [ 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 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode) 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