mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: console: Fix atomic corruption in ConsoleResizer
The update_console_size method was using fetch_and on the acked_features atomic, which modified the atomic and cleared other feature bits. Changed it to use a non-destructive load and bitwise AND. Signed-off-by: Andrei Vagin <avagin@google.com>
This commit is contained in:
@@ -526,11 +526,7 @@ impl ConsoleResizer {
|
|||||||
if let Some(tty) = self.tty.as_ref() {
|
if let Some(tty) = self.tty.as_ref() {
|
||||||
let (cols, rows) = get_win_size(tty);
|
let (cols, rows) = get_win_size(tty);
|
||||||
self.config.lock().unwrap().update_console_size(cols, rows);
|
self.config.lock().unwrap().update_console_size(cols, rows);
|
||||||
if self
|
if self.acked_features.load(Ordering::Acquire) & (1u64 << VIRTIO_CONSOLE_F_SIZE) != 0 {
|
||||||
.acked_features
|
|
||||||
.fetch_and(1u64 << VIRTIO_CONSOLE_F_SIZE, Ordering::AcqRel)
|
|
||||||
!= 0
|
|
||||||
{
|
|
||||||
// Send the interrupt to the driver
|
// Send the interrupt to the driver
|
||||||
let _ = self.config_evt.write(1);
|
let _ = self.config_evt.write(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user