Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential dealock for register_serial_device and register_vsock_device #221

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

liuw1
Copy link
Contributor

@liuw1 liuw1 commented Apr 22, 2024

Fix #218 and Fix #220

@liuw1 liuw1 requested a review from jyao1 April 22, 2024 06:56
@liuw1 liuw1 requested review from gaojiaqi7 and removed request for jyao1 April 29, 2024 07:43
SERIAL_DEVICE.lock().get_mut().unwrap().init()?;
let mut serial_device = SERIAL_DEVICE.lock();
serial_device.call_once(|| dev);
match serial_device.get_mut() {
Copy link
Contributor

@gaojiaqi7 gaojiaqi7 Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please simplify this with .ok_or(VirtioSerialError::Initialization)?.init()?

@liuw1 liuw1 force-pushed the fix-220 branch 2 times, most recently from 76849b1 to 1cf6389 Compare April 30, 2024 02:06
@@ -24,6 +24,8 @@ const VSOCK_BUF_ALLOC: u32 = 0x40000;

#[derive(Debug)]
pub enum VsockError {
/// Initialization error
InitializationError,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename to Initialization

@gaojiaqi7 gaojiaqi7 merged commit 262c7f2 into intel:main Apr 30, 2024
16 checks passed
@liuw1 liuw1 deleted the fix-220 branch September 19, 2024 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants