Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp580790pxx; Wed, 28 Oct 2020 11:36:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjsM3ayKgsN5k5329FhqE1hD/ktJLfTN8roTvAKJti2ByD5RdwhXPVQU9Qx2uLpl9sjtnQ X-Received: by 2002:aa7:d143:: with SMTP id r3mr226880edo.103.1603910203877; Wed, 28 Oct 2020 11:36:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603910203; cv=none; d=google.com; s=arc-20160816; b=sjs312qk/NA0vrBN5xJFR4LZpqKsnRfFVjA4N/2BkCZ4sWXxus4N9igmFdkqqp94jZ qRGHBecs9TRU6ft4Q01UsT/f8qUhBgQoZ80jeXfGJkzjxOkshJ6RiC/ZuegsCL6+iNcd VfceQ9hxVwrOoSgRZ5u1izwEnp4X+A5iEcNVqxjTzbFYjs6iBTUaiFJY23Q4N299MaQ8 5B2v3aKevKr3kLoYfsPHSg8WD7FPA6zCOgRJTls+tHEQOpp3/G+Tn9XrjmnWnPwx9GTf FLJhZPnPQ7LxNi1h0XZqKg7Pn51CNWu08d4TNUSc70aHvsJcch6vWeZJDAE8tHSaHvzq qG8A== 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=W2J+9XxZ6P2WQslmE6wf34GJSoOgXdBbM6WbQLLrQXs=; b=uWARdRWb5vQCtmQFC0idu7otUZSTqk4YbVVjxdejez7yyQVQqDC7zm3booYAXBJu+9 +D4/UJeo7KhMDy1GARnwO/ZYYmhIsolJ1FK9bKampi18zQBL1JVDZhH9Y+Te1Oy7R53L 8oiB4kx5Rx25ZRtqOIBOrRPnYOwtt51/BhXcQVJy2O0K6pHzZZoKDVIyQti/aqZfX+li WiK9LWAwe9YsUXK+uFckBK5FoBnLDKzijgCJ6rph09TGx8DnLK3uq6hspeInjcYxC4mv 9Wo+b7d732n0ju0frpb2nF6OqyGdKk2azyEdK2FoAIEMgpz89uADBCFIb0SXIa2Feb+i zfJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZbUcOcnN; 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 x19si30189edq.122.2020.10.28.11.36.21; Wed, 28 Oct 2020 11:36:43 -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=ZbUcOcnN; 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 S1825214AbgJ0SJl (ORCPT + 99 others); Tue, 27 Oct 2020 14:09:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:37110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756924AbgJ0OPQ (ORCPT ); Tue, 27 Oct 2020 10:15:16 -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 6440922202; Tue, 27 Oct 2020 14:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808116; bh=IWk44sx7GrIK1LwwY141DQgDJvGPoD7OCWS+WVpUCZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZbUcOcnNJfeOG7qeOsjN8yuBujSFsOzjc/4i14mWMIJSX/R124cYONFFP2o+T0eeP gzYtmi5M4mZTYGaxOFsRBpS2cA9esoXqTKoR04H35SXLxITqvlU2NX7bwyOH4Qmx4u Zkq0PemAdeMkZvYU3k/hR/xmCPwvdrwVYqf+yMJI= 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.14 162/191] udf: Limit sparing table size Date: Tue, 27 Oct 2020 14:50:17 +0100 Message-Id: <20201027134917.513573784@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@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 51de27685e185..2b8147ecd97fb 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1385,6 +1385,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