diff options
author | Logan Gunthorpe <logang@deltatee.com> | 2022-06-22 14:25:10 -0600 |
---|---|---|
committer | Jes Sorensen <jes@trained-monkey.org> | 2022-08-07 16:27:59 -0400 |
commit | 9ae62977b51dab0f4bb46b1c8ea5ebd1705b2f4d (patch) | |
tree | c8303e9b01db099e8cee93db4dfb488145f722b0 | |
parent | 548e9b916f86c06e2cdb50d8f49633f9bec66c7e (diff) | |
download | mdadm-9ae62977b51dab0f4bb46b1c8ea5ebd1705b2f4d.tar.gz |
monitor: Avoid segfault when calling NULL get_bad_blocks
Not all struct superswitch implement a get_bad_blocks() function,
yet mdmon seems to call it without checking for NULL and thus
occasionally segfaults in the test 10ddf-geometry.
Fix this by checking for NULL before calling it.
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>
-rw-r--r-- | monitor.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -311,6 +311,9 @@ static int check_for_cleared_bb(struct active_array *a, struct mdinfo *mdi) struct md_bb *bb; int i; + if (!ss->get_bad_blocks) + return -1; + /* * Get a list of bad blocks for an array, then read list of * acknowledged bad blocks from kernel and compare it against metadata |