summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Sharma <asharma@mvista.com>2023-11-28 22:43:34 +0530
committerSteve Sakoman <steve@sakoman.com>2023-12-08 11:45:59 -1000
commit59f99476d85205d97018641290b839ccfe72b134 (patch)
tree6854e1f28a5589aaf80c5f403130ba15820b638c
parent7f8394e2b1e0cdd4d5ebf83e3d907691be2edbb1 (diff)
downloadpoky-59f99476d85205d97018641290b839ccfe72b134.tar.gz
mdadm: Backport fix for CVE-2023-28938
Upstream-Status: Backport from [https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/patch/?id=7d374a1869d3a84971d027a7f4233878c8f25a62] CVE: CVE-2023-28938 (From OE-Core rev: 8cf02e6b60e2916b9e4832590257d5d184258e9c) Signed-off-by: Ashish Sharma <asharma@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-extended/mdadm/files/CVE-2023-28938.patch80
-rw-r--r--meta/recipes-extended/mdadm/mdadm_4.1.bb1
2 files changed, 81 insertions, 0 deletions
diff --git a/meta/recipes-extended/mdadm/files/CVE-2023-28938.patch b/meta/recipes-extended/mdadm/files/CVE-2023-28938.patch
new file mode 100644
index 0000000000..1e2990d79a
--- /dev/null
+++ b/meta/recipes-extended/mdadm/files/CVE-2023-28938.patch
@@ -0,0 +1,80 @@
1From 7d374a1869d3a84971d027a7f4233878c8f25a62 Mon Sep 17 00:00:00 2001
2From: Mateusz Grzonka <mateusz.grzonka@intel.com>
3Date: Tue, 27 Jul 2021 10:25:18 +0200
4Subject: Fix memory leak after "mdadm --detail"
5
6Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com>
7Signed-off-by: Jes Sorensen <jsorensen@fb.com>
8---
9Upstream-Status: Backport from [https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/patch/?id=7d374a1869d3a84971d027a7f4233878c8f25a62]
10CVE: CVE-2023-28938
11Signed-off-by: Ashish Sharma <asharma@mvista.com>
12
13 Detail.c | 20 +++++++++-----------
14 1 file changed, 9 insertions(+), 11 deletions(-)
15
16diff --git a/Detail.c b/Detail.c
17index ad56344f..d3af0ab5 100644
18--- a/Detail.c
19+++ b/Detail.c
20@@ -66,11 +66,11 @@ int Detail(char *dev, struct context *c)
21 int spares = 0;
22 struct stat stb;
23 int failed = 0;
24- struct supertype *st;
25+ struct supertype *st = NULL;
26 char *subarray = NULL;
27 int max_disks = MD_SB_DISKS; /* just a default */
28 struct mdinfo *info = NULL;
29- struct mdinfo *sra;
30+ struct mdinfo *sra = NULL;
31 struct mdinfo *subdev;
32 char *member = NULL;
33 char *container = NULL;
34@@ -93,8 +93,7 @@ int Detail(char *dev, struct context *c)
35 if (!sra) {
36 if (md_get_array_info(fd, &array)) {
37 pr_err("%s does not appear to be an md device\n", dev);
38- close(fd);
39- return rv;
40+ goto out;
41 }
42 }
43 external = (sra != NULL && sra->array.major_version == -1 &&
44@@ -108,16 +107,13 @@ int Detail(char *dev, struct context *c)
45 sra->devs == NULL) {
46 pr_err("Array associated with md device %s does not exist.\n",
47 dev);
48- close(fd);
49- sysfs_free(sra);
50- return rv;
51+ goto out;
52 }
53 array = sra->array;
54 } else {
55 pr_err("cannot get array detail for %s: %s\n",
56 dev, strerror(errno));
57- close(fd);
58- return rv;
59+ goto out;
60 }
61 }
62
63@@ -827,10 +823,12 @@ out:
64 close(fd);
65 free(subarray);
66 free(avail);
67- for (d = 0; d < n_devices; d++)
68- free(devices[d]);
69+ if (devices)
70+ for (d = 0; d < n_devices; d++)
71+ free(devices[d]);
72 free(devices);
73 sysfs_free(sra);
74+ free(st);
75 return rv;
76 }
77
78--
79cgit
80
diff --git a/meta/recipes-extended/mdadm/mdadm_4.1.bb b/meta/recipes-extended/mdadm/mdadm_4.1.bb
index 5238a41df2..ca326fd1cb 100644
--- a/meta/recipes-extended/mdadm/mdadm_4.1.bb
+++ b/meta/recipes-extended/mdadm/mdadm_4.1.bb
@@ -25,6 +25,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
25 file://include_sysmacros.patch \ 25 file://include_sysmacros.patch \
26 file://0001-mdadm-skip-test-11spare-migration.patch \ 26 file://0001-mdadm-skip-test-11spare-migration.patch \
27 file://CVE-2023-28736.patch \ 27 file://CVE-2023-28736.patch \
28 file://CVE-2023-28938.patch \
28 " 29 "
29 30
30SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598" 31SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598"