flexnbd status: Avoid a possible NULL dereference reading migration status
While the mirror mutex is taken, the mirroring can be abandoned and serve->mirror set to NULL, so we need to lock around reading information from serve->mirror
This commit is contained in:
@@ -11,12 +11,16 @@ struct status * status_create( struct server * serve )
|
||||
status->pid = getpid();
|
||||
status->size = serve->size;
|
||||
status->has_control = serve->success;
|
||||
status->is_mirroring = NULL != serve->mirror;
|
||||
|
||||
server_lock_start_mirror( serve );
|
||||
|
||||
status->is_mirroring = NULL != serve->mirror;
|
||||
if ( status->is_mirroring ) {
|
||||
status->migration_pass = serve->mirror->pass;
|
||||
}
|
||||
|
||||
server_unlock_start_mirror( serve );
|
||||
|
||||
return status;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user