Skip to content

Commit e6f9f5c

Browse files
[Low] Patch mdadm for CVE-2023-28938 (#13806)
1 parent 6b27e71 commit e6f9f5c

2 files changed

Lines changed: 83 additions & 1 deletion

File tree

SPECS/mdadm/CVE-2023-28938.patch

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
From 7d374a1869d3a84971d027a7f4233878c8f25a62 Mon Sep 17 00:00:00 2001
2+
From: Mateusz Grzonka <mateusz.grzonka@intel.com>
3+
Date: Tue, 27 Jul 2021 10:25:18 +0200
4+
Subject: Fix memory leak after "mdadm --detail"
5+
6+
Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com>
7+
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
8+
9+
Upstream Patch reference: https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=7d374a1869d3a84971d027a7f4233878c8f25a62
10+
---
11+
Detail.c | 20 +++++++++-----------
12+
1 file changed, 9 insertions(+), 11 deletions(-)
13+
14+
diff --git a/Detail.c b/Detail.c
15+
index ad56344f..d3af0ab5 100644
16+
--- a/Detail.c
17+
+++ b/Detail.c
18+
@@ -66,11 +66,11 @@ int Detail(char *dev, struct context *c)
19+
int spares = 0;
20+
struct stat stb;
21+
int failed = 0;
22+
- struct supertype *st;
23+
+ struct supertype *st = NULL;
24+
char *subarray = NULL;
25+
int max_disks = MD_SB_DISKS; /* just a default */
26+
struct mdinfo *info = NULL;
27+
- struct mdinfo *sra;
28+
+ struct mdinfo *sra = NULL;
29+
struct mdinfo *subdev;
30+
char *member = NULL;
31+
char *container = NULL;
32+
@@ -93,8 +93,7 @@ int Detail(char *dev, struct context *c)
33+
if (!sra) {
34+
if (md_get_array_info(fd, &array)) {
35+
pr_err("%s does not appear to be an md device\n", dev);
36+
- close(fd);
37+
- return rv;
38+
+ goto out;
39+
}
40+
}
41+
external = (sra != NULL && sra->array.major_version == -1 &&
42+
@@ -108,16 +107,13 @@ int Detail(char *dev, struct context *c)
43+
sra->devs == NULL) {
44+
pr_err("Array associated with md device %s does not exist.\n",
45+
dev);
46+
- close(fd);
47+
- sysfs_free(sra);
48+
- return rv;
49+
+ goto out;
50+
}
51+
array = sra->array;
52+
} else {
53+
pr_err("cannot get array detail for %s: %s\n",
54+
dev, strerror(errno));
55+
- close(fd);
56+
- return rv;
57+
+ goto out;
58+
}
59+
}
60+
61+
@@ -827,10 +823,12 @@ out:
62+
close(fd);
63+
free(subarray);
64+
free(avail);
65+
- for (d = 0; d < n_devices; d++)
66+
- free(devices[d]);
67+
+ if (devices)
68+
+ for (d = 0; d < n_devices; d++)
69+
+ free(devices[d]);
70+
free(devices);
71+
sysfs_free(sra);
72+
+ free(st);
73+
return rv;
74+
}
75+
76+
--
77+
cgit 1.2.3-korg
78+

SPECS/mdadm/mdadm.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Summary: The mdadm program controls Linux md devices (software RAID arrays)
44
Name: mdadm
55
Version: 4.1
6-
Release: 10%{?dist}
6+
Release: 11%{?dist}
77
License: GPLv2+
88
Vendor: Microsoft Corporation
99
Distribution: Mariner
@@ -23,6 +23,7 @@ Patch00: https://sources.debian.org/data/main/m/mdadm/4.1-2/debian/patche
2323
Patch97: mdadm-3.3-udev.patch
2424
Patch98: mdadm-2.5.2-static.patch
2525
Patch99: CVE-2023-28736.patch
26+
Patch100: CVE-2023-28938.patch
2627

2728
BuildRequires: binutils-devel
2829
BuildRequires: gcc
@@ -100,6 +101,9 @@ install -m644 %{SOURCE6} %{buildroot}%{_sysconfdir}/libreport/events.d
100101
%endif
101102

102103
%changelog
104+
* Thu May 15 2025 Akhila Guruju <v-guakhila@microsoft.com> - 4.1-11
105+
- Patch CVE-2023-28938
106+
103107
* Tue Feb 12 2025 Archana Shettigar <v-shettigara@microsoft.com> - 4.1-10
104108
- Patch CVE-2023-28736
105109

0 commit comments

Comments
 (0)