Bug 1227922 (CVE-2022-48777)

Summary: VUL-0: CVE-2022-48777: kernel: mtd: parsers: qcom: fix kernel panic on skipped partition
Product: [Novell Products] SUSE Security Incidents Reporter: SMASH SMASH <smash_bz>
Component: IncidentsAssignee: Security Team bot <security-team>
Status: RESOLVED FIXED QA Contact: Security Team bot <security-team>
Severity: Normal    
Priority: P3 - Medium CC: camila.matos, miroslav.franc
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://smash.suse.de/issue/414232/
Whiteboard: CVSSv3.1:SUSE:CVE-2022-48777:5.5:(AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H)
Found By: Security Response Team Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description SMASH SMASH 2024-07-16 13:01:58 UTC
Description
===========

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

mtd: parsers: qcom: Fix kernel panic on skipped partition

In the event of a skipped partition (case when the entry name is empty)
the kernel panics in the cleanup function as the name entry is NULL.
Rework the parser logic by first checking the real partition number and
then allocate the space and set the data for the valid partitions.

The logic was also fundamentally wrong as with a skipped partition, the
parts number returned was incorrect by not decreasing it for the skipped
partitions.

The Linux kernel CVE team has assigned CVE-2022-48777 to this issue.


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

	Issue introduced in 5.12 with commit 803eb124e1a6 and fixed in 5.15.25 with commit eb03cb6e03ff
	Issue introduced in 5.12 with commit 803eb124e1a6 and fixed in 5.16.11 with commit a2995fe23095
	Issue introduced in 5.12 with commit 803eb124e1a6 and fixed in 5.17 with commit 65d003cca335

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-2022-48777
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/mtd/parsers/qcomsmempart.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/eb03cb6e03ffd9173e18e5fe87e4e3ce83820453
	https://git.kernel.org/stable/c/a2995fe23095ceda2dc382fbe057f5e164595548
	https://git.kernel.org/stable/c/65d003cca335cabc0160d3cd7daa689eaa9dd3cd

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2022-48777
https://git.kernel.org/pub/scm/linux/security/vulns.git/plain/cve/published/2022/CVE-2022-48777.mbox
https://git.kernel.org/stable/c/eb03cb6e03ffd9173e18e5fe87e4e3ce83820453
https://git.kernel.org/stable/c/a2995fe23095ceda2dc382fbe057f5e164595548
https://git.kernel.org/stable/c/65d003cca335cabc0160d3cd7daa689eaa9dd3cd