Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1212425pxx; Tue, 27 Oct 2020 10:49:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEwZ1TcnecVljFJDlWfnNmLbPJ1OcKiPdL+xUtTiNvUbNA8LUvddRJOLsVUd8jxwsxLOcH X-Received: by 2002:a17:906:7c4b:: with SMTP id g11mr3658064ejp.469.1603820993646; Tue, 27 Oct 2020 10:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603820993; cv=none; d=google.com; s=arc-20160816; b=fykN6H3omGTZP6G8fOuTqdCFBvDguMDkm8pi6qSPoKggudVEK0LLfhdf07I8i4R6DV CW+QkUy3gXST5m0Xm2GKqfrTuIH41kw2oI2yaAPUH7JMSXlafPzHqCypokceB/XJ/rkh f7MgnJiteWLpEh24ggxqdtq6658X+UxHxQ9VQuT3NxGK6J/4rOhl4Fh1Hc49KPUUeUcQ mrXJK3hp5ks33IZNbOD0Q4TRmttV0teQI30oMIM0Tdy8CBj/N/Wo6lp/49qS1tQ8APTg GnNIBVes7Ju2dTrx327VACFZ1/eZX0QGH2rUSIdxSY66lyqBUY1u7vDJQ/NE0O7f3uHL bEQQ== 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=vvyk5ZyyjviWL1JBoXJ3gmYw5OzdPcCjBSbblOwMxCI=; b=qhWC/3Ww2uDHeZOdjH9O3bF1N9inUmQCRE29Ejt2ykkSZtjnj+rHy18lGHjIVOrWc3 Lg+f3TH9W0o3YaQIXLZxt5OVCkdYmdr6rjsXa8JzDA0xJJPBKoTc7DmBo/CI/UAnTHkJ BzTsB4pmHjVBxRXUVZd+lc8ty8kjcpzxFR9d0tzrPMX3h78U1/INmIKnVD9t2Jjl/PWM o3lPbimXK0iv/ek0fSuSOiRtfz1r6BgblsocL6M5VUmZoPVBvEQgZmvKJIM00l/TndXb kYFrwT1hoAYNpbUy+L0DiEXZwot94s4Dz4wku3ik0iDXMGjyNgpU+NzTDKlXdfL13BrE 8zYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J7KHtT9o; 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 d15si1520981ejb.664.2020.10.27.10.49.31; Tue, 27 Oct 2020 10:49:53 -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=J7KHtT9o; 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 S1783222AbgJ0O57 (ORCPT + 99 others); Tue, 27 Oct 2020 10:57:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:44820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762347AbgJ0Ooz (ORCPT ); Tue, 27 Oct 2020 10:44:55 -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 C8FE921D7B; Tue, 27 Oct 2020 14:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809895; bh=NMbRKQtIo06DCqElI09OojTwuYhyr225CCCA9tMoc+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J7KHtT9od7FXNW+DjKignJyZ9LpwwkXyt0tT6OSafeucwAZrvl2fjrbX9RlGf6se6 aWT/fiCs4Im+O8Bf0VYEiaNXEZfyHveVzxaa6FrzXBPXRj3HhHAsqhBrL+lQqFFzvM XbIEsYTE1PL2bPEPBluFUkunBdHQ2DiogeIjRvdU= 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 5.4 358/408] udf: Limit sparing table size Date: Tue, 27 Oct 2020 14:54:56 +0100 Message-Id: <20201027135511.624985906@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 4baa1ca91e9be..a0cd766b41cdb 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1352,6 +1352,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