Subject: CVE-2024-35813: mmc: core: Avoid negative index with array access

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

mmc: core: Avoid negative index with array access

Commit 4d0c8d0aef63 ("mmc: core: Use mrq.sbc in close-ended ffu") assigns
prev_idata = idatas[i - 1], but doesn't check that the iterator i is
greater than zero. Let's fix this by adding a check.

The Linux kernel CVE team has assigned CVE-2024-35813 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.4.269 with commit f49f9e802785 and fixed in 5.4.274 with commit b9a7339ae403
	Issue introduced in 5.10.210 with commit 59020bf0999f and fixed in 5.10.215 with commit 2b539c88940e
	Issue introduced in 5.15.149 with commit 50b8b7a22e90 and fixed in 5.15.154 with commit 81b8645feca0
	Issue introduced in 6.1.76 with commit c4edcd134bb7 and fixed in 6.1.84 with commit ad9cc5e9e53a
	Issue introduced in 6.6.15 with commit 1653a8102868 and fixed in 6.6.24 with commit 4466677dcabe
	Issue introduced in 6.7.3 with commit eed9119f8f8e and fixed in 6.7.12 with commit 064db53f9023
	Issue introduced in 6.8 with commit 4d0c8d0aef63 and fixed in 6.8.3 with commit 7d0e8a614755
	Issue introduced in 6.8 with commit 4d0c8d0aef63 and fixed in 6.9 with commit cf55a7acd1ed

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-35813
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/mmc/core/block.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/b9a7339ae403035ffe7fc37cb034b36947910f68
	https://git.kernel.org/stable/c/2b539c88940e22494da80a93ee1c5a28bbad10f6
	https://git.kernel.org/stable/c/81b8645feca08a54c7c4bf36e7b176f4983b2f28
	https://git.kernel.org/stable/c/ad9cc5e9e53ab94aa0c7ac65d43be7eb208dcb55
	https://git.kernel.org/stable/c/4466677dcabe2d70de6aa3d4bd4a4fafa94a71f2
	https://git.kernel.org/stable/c/064db53f9023a2d5877a2d12de6bc27995f6ca56
	https://git.kernel.org/stable/c/7d0e8a6147550aa058fa6ade8583ad252aa61304
	https://git.kernel.org/stable/c/cf55a7acd1ed38afe43bba1c8a0935b51d1dc014