Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp392777ybg; Tue, 22 Oct 2019 23:06:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCQcza9l8o60xz1K6WlyN7i/PMj9mW+kSaxqIjMYeh3LTsNTSGvUkVbXZsB6pKd1SieWVQ X-Received: by 2002:a17:906:3746:: with SMTP id e6mr4852021ejc.170.1571810772185; Tue, 22 Oct 2019 23:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571810772; cv=none; d=google.com; s=arc-20160816; b=bIJRyJeD2isXAn3R7IOIDKeOZhbpaoYhC8+skHQWpJmT0TRNSLeyf1QwL1D1sr/1xZ YqdsuI03lXDRhV/wTvJbFmFP0T/zOoOwONf3Pb+hWjQycZ2OUWtEmTPJ5mb8cZijnNUy zqu5Nt7MlpbP93wqEsdDTT3rAwEGfmNvU3pOsxy6RUUna+QJGvXXU4fv2oP+Rz5MhbFv JOlYpqwcSNn4hUvZDVRGjD4OXIPKtYLfD8ZCl7bhgKLB2A7YnHlHQWYvrT5lPO9tZclR ZoBLOg9BjUW8A2aY+f1/rtvmJLmuvjvilSo2+owzVVPexdhBfOxpkyyY41zubLsiz8oI aLsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=r8yGyzcHt/5wUrinDWH+ytUmE4oV+R3ThIbo+seuP3Y=; b=tv2gCJIyb3PljQ8ni/Yrzu2heAGbzcMPPgeBcaf6ycp5atTnPMU1NidffwFlxcG8hG XdwavbM8JX7BUs1T9MhEHEbf50WqZjoEUSD4+ewtta1sZgFJDHid3dyE6trsxrwlUCHP EWXPYTQ4WP0v7w/aUfK9uAnNvUt6stQ/gT0dWcCKE8p+4EFV1ueBzoL6M+GGi8jFCAU3 tuv6UzIRYON4Z5AM7fsLpHYwHkalKYGXHHIP48WkFODejAyRGxOXiLInaq8R0hauxP82 N7mIf3IYMSsX2OhlgJW5X854lEg+uQ7UlJh7XZlug5rWQF3GLdwrdsDaATUnwMFdauLk BscA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GyHp4wqo; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 o14si12185510ejc.405.2019.10.22.23.05.38; Tue, 22 Oct 2019 23:06:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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=GyHp4wqo; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 S1725789AbfJWFou (ORCPT + 99 others); Wed, 23 Oct 2019 01:44:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:41386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729233AbfJWFou (ORCPT ); Wed, 23 Oct 2019 01:44:50 -0400 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (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 6C1BA2173B; Wed, 23 Oct 2019 05:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571809489; bh=qv6OkyuwuHFLJc2lOZAfkkZ73EL6UqgUWYM2tnooTaE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GyHp4wqoR3EST8V51UxYHzareLgqFn2QIND/mvztJUtGoQX6zEAZWw9qvhODNdEsR QGnUC+6YB2/8Yj4t315P+kiS2Fodt+F1uqWc4sclO1trnHQhgb+TNDN7PSLE54/Q/R rFOYPRHetzkZiWZHroDT85TDLeeBPw/51d91th3s= Date: Tue, 22 Oct 2019 22:44:47 -0700 From: Eric Biggers To: Theodore Ts'o Cc: Ext4 Developers List , stable@kernel.org Subject: Re: [PATCH] ext4: fix signed vs unsigned comparison in ext4_valid_extent() Message-ID: <20191023054447.GE361298@sol.localdomain> Mail-Followup-To: Theodore Ts'o , Ext4 Developers List , stable@kernel.org References: <20191023013112.18809-1-tytso@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191023013112.18809-1-tytso@mit.edu> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Oct 22, 2019 at 09:31:12PM -0400, Theodore Ts'o wrote: > Due to a signed vs unsigned comparison, an invalid extent where > ee_block (the logical block) is so large that lblk + len overflow > wasn't getting flagged as invalid. > > As a result, we tripped the BUG_ON(end < lblk) in > ext4_es_cache_extent() when trying to mount a file system with a > corrupted journal inode was corrupted. > > https://bugzilla.kernel.org/show_bug.cgi?id=205197 > > Signed-off-by: Theodore Ts'o > Cc: stable@kernel.org > --- > fs/ext4/extents.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c > index fb0f99dc8c22..d12bc287abdc 100644 > --- a/fs/ext4/extents.c > +++ b/fs/ext4/extents.c > @@ -367,7 +367,7 @@ ext4_ext_max_entries(struct inode *inode, int depth) > static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext) > { > ext4_fsblk_t block = ext4_ext_pblock(ext); > - int len = ext4_ext_get_actual_len(ext); > + unsigned int len = ext4_ext_get_actual_len(ext); > ext4_lblk_t lblock = le32_to_cpu(ext->ee_block); > > /* > -- > 2.23.0 > This patch can't be fixing anything because the comparison is unsigned both before and after this patch. - Eric