Accepting request 1089072 from Base:System

OBS-URL: https://build.opensuse.org/request/show/1089072
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mdadm?expand=0&rev=143
This commit is contained in:
Dominique Leuenberger 2023-05-28 17:21:20 +00:00 committed by Git OBS Bridge
commit b09ceae2dd
5 changed files with 106 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 434b3b9bb96a76dc12f693b64cf23b581781e20b Mon Sep 17 00:00:00 2001
From: Blazej Kucman <blazej.kucman@intel.com>
Date: Tue, 20 Dec 2022 12:07:51 +0100
Subject: [PATCH] Grow: fix possible memory leak.
Git-commit: 434b3b9bb96a76dc12f693b64cf23b581781e20b
Patch-mainline: mdadm-4.2+
References: bsc#1208618
Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Signed-off-by: Coly Li <colyli@suse.de>
---
Grow.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Grow.c b/Grow.c
index e362403..b73ec2a 100644
--- a/Grow.c
+++ b/Grow.c
@@ -432,6 +432,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
if (((disk.state & (1 << MD_DISK_WRITEMOSTLY)) == 0) &&
(strcmp(s->bitmap_file, "clustered") == 0)) {
pr_err("%s disks marked write-mostly are not supported with clustered bitmap\n",devname);
+ free(mdi);
return 1;
}
fd2 = dev_open(dv, O_RDWR);
@@ -453,8 +454,10 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
pr_err("failed to load super-block.\n");
}
close(fd2);
- if (rv)
+ if (rv) {
+ free(mdi);
return 1;
+ }
}
if (offset_setable) {
st->ss->getinfo_super(st, mdi, NULL);
--
2.35.3

View File

@ -0,0 +1,47 @@
From d07e561810a2e33b667a8a9476edaff42eb119b9 Mon Sep 17 00:00:00 2001
From: Heming Zhao <heming.zhao@suse.com>
Date: Thu, 23 Feb 2023 22:39:39 +0800
Subject: [PATCH] Grow: fix can't change bitmap type from none to clustered.
Git-commit: d07e561810a2e33b667a8a9476edaff42eb119b9
Patch-mainline: mdadm-4.2+
References: bsc#1208618
Commit a042210648ed ("disallow create or grow clustered bitmap with
writemostly set") introduced this bug. We should use 'true' logic not
'== 0' to deny setting up clustered array under WRITEMOSTLY condition.
How to trigger
```
~/mdadm # ./mdadm -Ss && ./mdadm --zero-superblock /dev/sd{a,b}
~/mdadm # ./mdadm -C /dev/md0 -l mirror -b clustered -e 1.2 -n 2 \
/dev/sda /dev/sdb --assume-clean
mdadm: array /dev/md0 started.
~/mdadm # ./mdadm --grow /dev/md0 --bitmap=none
~/mdadm # ./mdadm --grow /dev/md0 --bitmap=clustered
mdadm: /dev/md0 disks marked write-mostly are not supported with clustered bitmap
```
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
---
Grow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Grow.c b/Grow.c
index 8f5cf07..bb5fe45 100644
--- a/Grow.c
+++ b/Grow.c
@@ -429,7 +429,7 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s)
dv = map_dev(disk.major, disk.minor, 1);
if (!dv)
continue;
- if (((disk.state & (1 << MD_DISK_WRITEMOSTLY)) == 0) &&
+ if ((disk.state & (1 << MD_DISK_WRITEMOSTLY)) &&
(strcmp(s->bitmap_file, "clustered") == 0)) {
pr_err("%s disks marked write-mostly are not supported with clustered bitmap\n",devname);
free(mdi);
--
2.35.3

BIN
mdadm-4.2.tar.xz (Stored with Git LFS)

Binary file not shown.

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Fri May 26 02:29:42 UTC 2023 - Coly Li <colyli@suse.de>
- Grow: fix possible memory leak (bsc#1208618)
0060-Grow-fix-possible-memory-leak.patch
- Grow: fix can't change bitmap type from none to clustered
(bsc#1208618)
0061-Grow-fix-can-t-change-bitmap-type-from-none-to-clustered.patch
- Use source code mdadm-4.2.tar.xz from kernel.org version for
checksum
- mdadm-4.2.tar.xz
-------------------------------------------------------------------
Mon Apr 24 15:06:42 UTC 2023 - Coly Li <colyli@suse.de>

View File

@ -100,6 +100,8 @@ Patch56: 0056-mdmon-Remove-need-for-KillMode-none.patch
Patch57: 0057-mdmon-Improve-switchroot-interactions.patch
Patch58: 0058-mdopen-always-try-create_named_array.patch
Patch59: 0059-Improvements-for-IMSM_NO_PLATFORM-testing.patch
Patch60: 0060-Grow-fix-possible-memory-leak.patch
Patch61: 0061-Grow-fix-can-t-change-bitmap-type-from-none-to-clustered.patch
Patch1001: 1001-display-timeout-status.patch
Patch1002: 1002-OnCalendar-format-fix-of-mdcheck_start-timer.patch
Patch1003: 1003-mdadm-treat-the-Dell-softraid-array-as-local-array.patch
@ -171,6 +173,8 @@ mdadm is a program that can be used to control Linux md devices.
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1