From e1c09b66baa722fcccf1a1aa84a9573ae2e7d6c6 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 6 Dec 2021 14:14:18 +0000 Subject: [PATCH] vmm: Replace device tree value when restoring DeviceManager When restoring replace the internal value of the device tree rather than replacing the Arc> itself. This is fixes an issue where the AddressManager has a copy of the the original Arc> from when the DeviceManager was created. The original restore path only replaced the DeviceManager's version of the Arc>. Instead replace the contents of the Arc> so all users see the updated version. Signed-off-by: Rob Bradford --- vmm/src/device_manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 27910b60e..d61cab445 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -1167,7 +1167,7 @@ impl DeviceManager { } fn set_state(&mut self, state: &DeviceManagerState) { - self.device_tree = Arc::new(Mutex::new(state.device_tree.clone())); + *self.device_tree.lock().unwrap() = state.device_tree.clone(); self.device_id_cnt = state.device_id_cnt; }