summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/mdadm/files/CVE-2023-28736.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/mdadm/files/CVE-2023-28736.patch')
-rw-r--r--meta/recipes-extended/mdadm/files/CVE-2023-28736.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/meta/recipes-extended/mdadm/files/CVE-2023-28736.patch b/meta/recipes-extended/mdadm/files/CVE-2023-28736.patch
new file mode 100644
index 0000000000..8e0a06cbc7
--- /dev/null
+++ b/meta/recipes-extended/mdadm/files/CVE-2023-28736.patch
@@ -0,0 +1,77 @@
1From ced5fa8b170ad448f4076e24a10c731b5cfb36ce Mon Sep 17 00:00:00 2001
2From: Blazej Kucman <blazej.kucman@intel.com>
3Date: Fri, 3 Dec 2021 15:31:15 +0100
4Subject: mdadm: block creation with long names
5
6This fixes buffer overflows in create_mddev(). It prohibits
7creation with not supported names for DDF and native. For IMSM,
8mdadm will do silent cut to 16 later.
9
10Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
11Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
12Signed-off-by: Jes Sorensen <jsorensen@fb.com>
13---
14
15Upstream-Status: Backport from [https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/patch/?id=ced5fa8b170ad448f4076e24a10c731b5cfb36ce]
16CVE: CVE-2023-28736
17Signed-off-by: Ashish Sharma <asharma@mvista.com>
18
19 mdadm.8.in | 5 +++++
20 mdadm.c | 9 ++++++++-
21 mdadm.h | 5 +++++
22 3 files changed, 18 insertions(+), 1 deletion(-)
23
24diff --git a/mdadm.8.in b/mdadm.8.in
25index 28d773c2..68e100cb 100644
26--- a/mdadm.8.in
27+++ b/mdadm.8.in
28@@ -2186,6 +2186,11 @@ is run, but will be created by
29 .I udev
30 once the array becomes active.
31
32+The max length md-device name is limited to 32 characters.
33+Different metadata types have more strict limitation
34+(like IMSM where only 16 characters are allowed).
35+For that reason, long name could be truncated or rejected, it depends on metadata policy.
36+
37 As devices are added, they are checked to see if they contain RAID
38 superblocks or filesystems. They are also checked to see if the variance in
39 device size exceeds 1%.
40diff --git a/mdadm.c b/mdadm.c
41index 91e67467..26299b2e 100644
42--- a/mdadm.c
43+++ b/mdadm.c
44@@ -1359,9 +1359,16 @@ int main(int argc, char *argv[])
45 mdfd = open_mddev(devlist->devname, 1);
46 if (mdfd < 0)
47 exit(1);
48- } else
49+ } else {
50+ char *bname = basename(devlist->devname);
51+
52+ if (strlen(bname) > MD_NAME_MAX) {
53+ pr_err("Name %s is too long.\n", devlist->devname);
54+ exit(1);
55+ }
56 /* non-existent device is OK */
57 mdfd = open_mddev(devlist->devname, 0);
58+ }
59 if (mdfd == -2) {
60 pr_err("device %s exists but is not an md array.\n", devlist->devname);
61 exit(1);
62diff --git a/mdadm.h b/mdadm.h
63index 54567396..c7268a71 100644
64--- a/mdadm.h
65+++ b/mdadm.h
66@@ -1880,3 +1880,8 @@ enum r0layout {
67 #define INVALID_SECTORS 1
68 /* And another special number needed for --data_offset=variable */
69 #define VARIABLE_OFFSET 3
70+
71+/**
72+ * This is true for native and DDF, IMSM allows 16.
73+ */
74+#define MD_NAME_MAX 32
75--
76cgit
77