Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp182204pxx; Wed, 28 Oct 2020 01:56:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6OgYZ8OyRfpW+qgLh/Re9ChFh1XgUFZWIZBkxkb4FcCAYe4fdOdqms85pY6+DBJ9B1DZS X-Received: by 2002:aa7:d28c:: with SMTP id w12mr6668996edq.248.1603875371344; Wed, 28 Oct 2020 01:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603875371; cv=none; d=google.com; s=arc-20160816; b=Fbb0LRuNmQS8jXTfsBWHmzjiN47XqDv8Z1nrGo7I2Zj82GwXcFIoQpm081YmWxrRO3 za2Dw1QhFDEw/ci0ZBDv4yJnjo83GnXqcTDsxandABxtL3ZV5xlXUFO0SwQjVMzagmg9 8u23qZK0CR8tJ2ntmiHgLE89uTyCh3QSqhsX4sIJQo78A8iLn4cDia1NbpIOEH2Rj3lq R9ZdbYTDFVf1BkxuQoLrcUvkiP75DqvHG0zA3wG7jbE/Mc+wKL34Q26roYba7a5te5XH qpynR4iEIZXyUSjOD+yigbTUPznNurpvFg3HkkclLbPb9kgvQp8vycRmOVdvASvrOEmP psoA== 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=cAUDEJ0MUN8Z6oDe7/Q/wd7ugfD1kgOEe8r6jqVM80s=; b=Iu5m9CbKosyEVxbn6yGCpPgt8MPv9CZ64fdi6yfmj2v7Cv0gatAzMx0mAgX73lUbV/ gOhSqGycj/ahNGDELuTrQxXTXNasNQA36pI8NkSUCCTIA/W39S3LRyGwIIPLr/cw+kg7 /poFfAuwvVK/EjAkKM84tzWzCZQDWwKP0yhn2xzo+wWXSCxYQ4I9xnFYLu3U0TXnTGwx DhgQ8YgMVAKsY0upKL0dwBzc0JOu0RKbpqEXL5e1VFkfTkHNtW1iOLjK/70qazXBc2wI Qd7k4ERNjLV8dWN6AA4SYjEpTuDyAm4Ym4L/wFkhd9EsgKskdhp+ZgqB54lyBEMN9uHk vHMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kKZ9yzIT; 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 b6si3402013edu.343.2020.10.28.01.55.49; Wed, 28 Oct 2020 01:56:11 -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=kKZ9yzIT; 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 S1756580AbgJ0OOR (ORCPT + 99 others); Tue, 27 Oct 2020 10:14:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:55420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754744AbgJ0OGu (ORCPT ); Tue, 27 Oct 2020 10:06:50 -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 477C822258; Tue, 27 Oct 2020 14:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807609; bh=grUqw/DYVQzulCJPfyXD4JR5EqVAtyYq6JiU5FRZc6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kKZ9yzITHaaJifwu/Y7ppxj9Fzq9bQSuce8/g//slGk0xHrApJzRSwz7pZQHSVq52 hlr1jZkTgJI68mp7FwFBPUEMo5Xnk9BWOTVyDjRgvMpf3/g1TQ5YskCSp9gNWfELda iMnE2darW4HTPxVEt75sr3NIrLs1g3wzjnJClfy0= 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.9 116/139] udf: Limit sparing table size Date: Tue, 27 Oct 2020 14:50:10 +0100 Message-Id: <20201027134907.647267552@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@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 4abdba453885e..c8c037e8e57b5 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1391,6 +1391,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