Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1087388pxx; Tue, 27 Oct 2020 08:01:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6gH/v0L1YZTHCjigxCE/RTU2W/wuQyp3LXQSKQPgEsE29+vMRe6WOHnJb6NmlMI+gq6ht X-Received: by 2002:a17:906:d9c1:: with SMTP id qk1mr2899952ejb.426.1603810863596; Tue, 27 Oct 2020 08:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603810863; cv=none; d=google.com; s=arc-20160816; b=ItPy49Ty1Q9iqDZB4lGtLrn7ACC8/1uip81bKynFqEKP0JJJwgCOEIlyBCvM5sCFoC jJHRszuFie5uP+Ms+IFY6mrPowUKBm2mCsvtqRJoGgHDOhxSPOot5YjFWDvbOSk70XlA bkgt3aMkHJWzCQv1Sf+0/iN+8O7/ssubu0FvKmb59m1g6CItgVCc3usXXqIQefzhtEDT vF9tWHRQzghIGFXBBWJMJ7vd+bm0b9JGfJhFRwF4GBhuEnH3deq9gtfAg7yGB68YitxP RX5xUmWojS3HFB1iPn8QWIE7CXfO4Z89K8Qkmw8MZq2ozTTzPOQH/oYgtdt+QXtnVqYO JocA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Dy/VwDNrenzWS9CfUc2X590VagGsf/76YEkcG1L62LM=; b=O0+AZ0dUjqF8kA2RBTAM4AJXxWe5ihA9WqK7PC6R2MlW0VAgxyUpb+pkw5rvvJfGkS mpQBiFJxawMEqSB/NUR185CphJC3LyZbMb3EpbJGgV4pnUXzdLk4N+tmJEyaydUVCe9l IWzJPxjuhK0AGyflGPaanTeal8ffQQknJoglZYAmsg63erexrlwMJTufgDvte8xWVp1a dr4Zz3Nt4XF0/jw6ZQWKwXb+JJgfCbZ1bctOkxKzp3eZkLGZ9LOv9a82yqgDIWFcQPQm rfWqyhE8QqaoGuNkTj6eJjWwUg91m60DSXdrxw3nI062CXFuxe8JsOYIDlBc7n5sQ94S KZBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R3NohsjH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p3si1290381edd.200.2020.10.27.08.00.39; Tue, 27 Oct 2020 08:01:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R3NohsjH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753728AbgJ0OBn (ORCPT + 99 others); Tue, 27 Oct 2020 10:01:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:48478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409141AbgJ0OA4 (ORCPT ); Tue, 27 Oct 2020 10:00:56 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 0B698221F7; Tue, 27 Oct 2020 14:00:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807255; bh=iUI6R6966a9LouajXCH0TTpKJIFM3Q78qhVfapjRgKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R3NohsjHS5yCZ4z/OWY9z5aeKdgzuIi+dVtJhoMKbfWH+TB8XQb0wmKjZLcXX+1pG mRW2qCSEFQB8yJnBJRAvGl10IjPP4TwJOb/816HAvg0O3FttITPB9yUNzNyJn0qsx+ n59dSZH2xtXl0r8bt6cIOX/hWa5zCDcHnz/xeOPs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+9991561e714f597095da@syzkaller.appspotmail.com, Jan Kara , Sasha Levin Subject: [PATCH 4.4 092/112] udf: Limit sparing table size Date: Tue, 27 Oct 2020 14:50:02 +0100 Message-Id: <20201027134904.900468283@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134900.532249571@linuxfoundation.org> References: <20201027134900.532249571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Kara [ Upstream commit 44ac6b829c4e173fdf6df18e6dd86aecf9a3dc99 ] Although UDF standard allows it, we don't support sparing table larger than a single block. Check it during mount so that we don't try to access memory beyond end of buffer. Reported-by: syzbot+9991561e714f597095da@syzkaller.appspotmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin --- fs/udf/super.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/udf/super.c b/fs/udf/super.c index 159977ec8e548..710f1b8fad9bf 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1390,6 +1390,12 @@ static int udf_load_sparable_map(struct super_block *sb, (int)spm->numSparingTables); return -EIO; } + if (le32_to_cpu(spm->sizeSparingTable) > sb->s_blocksize) { + udf_err(sb, "error loading logical volume descriptor: " + "Too big sparing table size (%u)\n", + le32_to_cpu(spm->sizeSparingTable)); + return -EIO; + } for (i = 0; i < spm->numSparingTables; i++) { loc = le32_to_cpu(spm->locSparingTable[i]); -- 2.25.1