!38 修复mdadm执行生成crash
From: @lixiaokeng Reviewed-by: @liuzhiqiang26 Signed-off-by: @liuzhiqiang26
This commit is contained in:
commit
056c811bb4
@ -0,0 +1,48 @@
|
|||||||
|
From b016fbfdda1fc1c9ddc1e590d53da3fa86212f9c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Logan Gunthorpe <logang@deltatee.com>
|
||||||
|
Date: Wed, 22 Jun 2022 14:25:08 -0600
|
||||||
|
Subject: [PATCH] DDF: Fix NULL pointer dereference in validate_geometry_ddf()
|
||||||
|
|
||||||
|
A relatively recent patch added a call to validate_geometry() in
|
||||||
|
Manage_add() that has level=LEVEL_CONTAINER and chunk=NULL.
|
||||||
|
|
||||||
|
This causes some ddf tests to segfault which aborts the test suite.
|
||||||
|
|
||||||
|
To fix this, avoid dereferencing chunk when the level is
|
||||||
|
LEVEL_CONTAINER or LEVEL_NONE.
|
||||||
|
|
||||||
|
Fixes: 1f5d54a06df0 ("Manage: Call validate_geometry when adding drive to external container")
|
||||||
|
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
|
||||||
|
Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
||||||
|
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
|
||||||
|
---
|
||||||
|
super-ddf.c | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/super-ddf.c b/super-ddf.c
|
||||||
|
index a592c5d..d4dd334 100644
|
||||||
|
--- a/super-ddf.c
|
||||||
|
+++ b/super-ddf.c
|
||||||
|
@@ -3340,9 +3340,6 @@ static int validate_geometry_ddf(struct supertype *st,
|
||||||
|
* If given BVDs, we make an SVD, changing all the GUIDs in the process.
|
||||||
|
*/
|
||||||
|
|
||||||
|
- if (*chunk == UnSet)
|
||||||
|
- *chunk = DEFAULT_CHUNK;
|
||||||
|
-
|
||||||
|
if (level == LEVEL_NONE)
|
||||||
|
level = LEVEL_CONTAINER;
|
||||||
|
if (level == LEVEL_CONTAINER) {
|
||||||
|
@@ -3354,6 +3351,9 @@ static int validate_geometry_ddf(struct supertype *st,
|
||||||
|
verbose);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (*chunk == UnSet)
|
||||||
|
+ *chunk = DEFAULT_CHUNK;
|
||||||
|
+
|
||||||
|
if (!dev) {
|
||||||
|
mdu_array_info_t array = {
|
||||||
|
.level = level,
|
||||||
|
--
|
||||||
|
2.14.3 (Apple Git-98)
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: mdadm
|
Name: mdadm
|
||||||
Version: 4.2
|
Version: 4.2
|
||||||
Release: 4
|
Release: 5
|
||||||
Summary: The software RAID arrays user manage tools
|
Summary: The software RAID arrays user manage tools
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
|
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
|
||||||
@ -16,6 +16,7 @@ Patch3: 0003-monitor-Avoid-segfault-when-calling-NULL-get_bad_blo.patch
|
|||||||
Patch4: 0004-mdadm-mdcheck_start.service-mdcheck_continue.service.patch
|
Patch4: 0004-mdadm-mdcheck_start.service-mdcheck_continue.service.patch
|
||||||
Patch5: 0005-Fix-possible-NULL-ptr-dereferences-and-memory-leaks.patch
|
Patch5: 0005-Fix-possible-NULL-ptr-dereferences-and-memory-leaks.patch
|
||||||
Patch6: 0006-mdadm-Don-t-open-md-device-for-CREATE-and-ASSEMBLE.patch
|
Patch6: 0006-mdadm-Don-t-open-md-device-for-CREATE-and-ASSEMBLE.patch
|
||||||
|
Patch7: 0007-DDF-Fix-NULL-pointer-dereference-in-validate_geometr.patch
|
||||||
|
|
||||||
BuildRequires: systemd gcc binutils libudev-devel
|
BuildRequires: systemd gcc binutils libudev-devel
|
||||||
Requires(post): systemd coreutils
|
Requires(post): systemd coreutils
|
||||||
@ -81,6 +82,9 @@ install -d -m 710 %{buildroot}/var/run/mdadm/
|
|||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Dec 16 2022 Lixiaokeng <lixiaokeng@huawei.com> - 4.2-5
|
||||||
|
* fix NULL dereference
|
||||||
|
|
||||||
* Thu Dec 8 2022 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 4.2-4
|
* Thu Dec 8 2022 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 4.2-4
|
||||||
- backport two bugfix patches
|
- backport two bugfix patches
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user