summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/mdadm/files/0004-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/mdadm/files/0004-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch')
-rw-r--r--meta/recipes-extended/mdadm/files/0004-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/meta/recipes-extended/mdadm/files/0004-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch b/meta/recipes-extended/mdadm/files/0004-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch
new file mode 100644
index 0000000000..72cb40f782
--- /dev/null
+++ b/meta/recipes-extended/mdadm/files/0004-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch
@@ -0,0 +1,42 @@
1From 2296a4a441b4b8546e2eb32403930f1bb8f3ee4a Mon Sep 17 00:00:00 2001
2From: Logan Gunthorpe <logang@deltatee.com>
3Date: Wed, 22 Jun 2022 14:25:10 -0600
4Subject: [PATCH 4/4] monitor: Avoid segfault when calling NULL get_bad_blocks
5
6Not all struct superswitch implement a get_bad_blocks() function,
7yet mdmon seems to call it without checking for NULL and thus
8occasionally segfaults in the test 10ddf-geometry.
9
10Fix this by checking for NULL before calling it.
11
12Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
13Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
14Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
15
16Upstream-Status: Backport
17
18Reference to upstream patch:
19https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=9ae62977b51d
20
21Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
22---
23 monitor.c | 3 +++
24 1 file changed, 3 insertions(+)
25
26diff --git a/monitor.c b/monitor.c
27index afc3e50..8e43c0d 100644
28--- a/monitor.c
29+++ b/monitor.c
30@@ -312,6 +312,9 @@ static int check_for_cleared_bb(struct active_array *a, struct mdinfo *mdi)
31 struct md_bb *bb;
32 int i;
33
34+ if (!ss->get_bad_blocks)
35+ return -1;
36+
37 /*
38 * Get a list of bad blocks for an array, then read list of
39 * acknowledged bad blocks from kernel and compare it against metadata
40--
412.39.1
42