From a749063c8ad023b3b2cc88a65f6f85fa78a38503 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 4 Jan 2022 10:54:30 +0000 Subject: [PATCH] vmm: Don't assume that resize_pipe is initialised If the underlying kernel is old PTY resize is disabled and this is represented by the use of None in the provided Option type. In the virtio-console PTY path don't blindly unwrap() the value that will be preserved across a reboot. Fixes: #3496 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 74c9052c2..a92d5b15f 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -1742,7 +1742,7 @@ impl DeviceManager { self.config.lock().unwrap().console.file = Some(pty.path.clone()); let file = pty.main.try_clone().unwrap(); self.console_pty = Some(Arc::new(Mutex::new(pty))); - self.console_resize_pipe = Some(Arc::new(resize_pipe.unwrap())); + self.console_resize_pipe = resize_pipe.map(Arc::new); Endpoint::FilePair(file.try_clone().unwrap(), file) } else { let (main, mut sub, path) =