diff --git a/raid/module.c b/raid/module.c index 3f244ef6..c5fa05b4 100644 --- a/raid/module.c +++ b/raid/module.c @@ -779,6 +779,12 @@ int raid_selftest(void) ret = 0; bail: + /* + * Reset the global zero buffer so that it does not point to + * the deallocated memory. + */ + raid_zero(0); + free(v); free(v_alloc); diff --git a/raid/raid.h b/raid/raid.h index b8012797..459adeba 100644 --- a/raid/raid.h +++ b/raid/raid.h @@ -161,6 +161,10 @@ int raid_mode(int mode); * The test modifies global RAID state and must not be called concurrently * with any other RAID function. * + * The test resets the zero buffer to 0 via raid_zero(0) upon completion. + * A valid zero buffer must be set with raid_zero() afterwards before calling + * recovery functions (raid_rec(), raid_data()). + * * It returns 0 on success. */ int raid_selftest(void);