* [PATCH] super1: fix Floating point exception
@ 2021-01-30 9:49 Zhao Heming
2021-03-02 8:34 ` resend: [PATCH mdadm] " heming.zhao
2021-03-03 14:30 ` [PATCH] " Jes Sorensen
0 siblings, 2 replies; 3+ messages in thread
From: Zhao Heming @ 2021-01-30 9:49 UTC (permalink / raw)
To: linux-raid, jes; +Cc: Zhao Heming, lidong.zhong, xni
write_bitmap1 didn't check return value of locate_bitmap1, which will
operate bitmap area under invalid bitmap info.
mdadm core dumped when doing below steps:
```
node1 # mdadm -C /dev/md0 -b none -e 1.2 -n 2 -l mirror /dev/sda /dev/sdb
node1 # mdadm -Ss
node1 # mdadm -A -U home-cluster --home-cluster=abc /dev/md0 /dev/sda /dev/sdb
Floating point exception (core dumped)
```
Signed-off-by: Zhao Heming <heming.zhao@suse.com>
---
super1.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/super1.c b/super1.c
index 8b0d6ff..19fe6f5 100644
--- a/super1.c
+++ b/super1.c
@@ -2683,7 +2683,10 @@ static int write_bitmap1(struct supertype *st, int fd, enum bitmap_update update
init_afd(&afd, fd);
- locate_bitmap1(st, fd, 0);
+ if (locate_bitmap1(st, fd, 0) < 0) {
+ pr_err("Error: Invalid bitmap\n");
+ return -EINVAL;
+ }
if (posix_memalign(&buf, 4096, 4096))
return -ENOMEM;
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* resend: [PATCH mdadm] super1: fix Floating point exception
2021-01-30 9:49 [PATCH] super1: fix Floating point exception Zhao Heming
@ 2021-03-02 8:34 ` heming.zhao
2021-03-03 14:30 ` [PATCH] " Jes Sorensen
1 sibling, 0 replies; 3+ messages in thread
From: heming.zhao @ 2021-03-02 8:34 UTC (permalink / raw)
To: linux-raid, jes; +Cc: Zhao Heming, lidong.zhong, xni
write_bitmap1 didn't check return value of locate_bitmap1, which will
operate bitmap area under invalid bitmap info.
mdadm core dumped when doing below steps:
```
node1 # mdadm -C /dev/md0 -b none -e 1.2 -n 2 -l mirror /dev/sda /dev/sdb
node1 # mdadm -Ss
node1 # mdadm -A -U home-cluster --home-cluster=abc /dev/md0 /dev/sda /dev/sdb
Floating point exception (core dumped)
```
Signed-off-by: Zhao Heming <heming.zhao@suse.com>
---
super1.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/super1.c b/super1.c
index 8b0d6ff..19fe6f5 100644
--- a/super1.c
+++ b/super1.c
@@ -2683,7 +2683,10 @@ static int write_bitmap1(struct supertype *st, int fd, enum bitmap_update update
init_afd(&afd, fd);
- locate_bitmap1(st, fd, 0);
+ if (locate_bitmap1(st, fd, 0) < 0) {
+ pr_err("Error: Invalid bitmap\n");
+ return -EINVAL;
+ }
if (posix_memalign(&buf, 4096, 4096))
return -ENOMEM;
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] super1: fix Floating point exception
2021-01-30 9:49 [PATCH] super1: fix Floating point exception Zhao Heming
2021-03-02 8:34 ` resend: [PATCH mdadm] " heming.zhao
@ 2021-03-03 14:30 ` Jes Sorensen
1 sibling, 0 replies; 3+ messages in thread
From: Jes Sorensen @ 2021-03-03 14:30 UTC (permalink / raw)
To: Zhao Heming, linux-raid; +Cc: lidong.zhong, xni
On 1/30/21 4:49 AM, Zhao Heming wrote:
> write_bitmap1 didn't check return value of locate_bitmap1, which will
> operate bitmap area under invalid bitmap info.
>
> mdadm core dumped when doing below steps:
> ```
> node1 # mdadm -C /dev/md0 -b none -e 1.2 -n 2 -l mirror /dev/sda /dev/sdb
> node1 # mdadm -Ss
> node1 # mdadm -A -U home-cluster --home-cluster=abc /dev/md0 /dev/sda /dev/sdb
> Floating point exception (core dumped)
> ```
>
> Signed-off-by: Zhao Heming <heming.zhao@suse.com>
> ---
> super1.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Applied!
Thanks,
Jes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-04 0:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-30 9:49 [PATCH] super1: fix Floating point exception Zhao Heming
2021-03-02 8:34 ` resend: [PATCH mdadm] " heming.zhao
2021-03-03 14:30 ` [PATCH] " Jes Sorensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).