From 9f569c7b8db6d6722df1cd26441eefc7002e76ae Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Thu, 5 Mar 2026 23:01:11 +0000 Subject: [PATCH] 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 --- virtio-devices/src/console.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/virtio-devices/src/console.rs b/virtio-devices/src/console.rs index 7896fde9f..fc715eaac 100644 --- a/virtio-devices/src/console.rs +++ b/virtio-devices/src/console.rs @@ -526,11 +526,7 @@ impl ConsoleResizer { if let Some(tty) = self.tty.as_ref() { let (cols, rows) = get_win_size(tty); self.config.lock().unwrap().update_console_size(cols, rows); - if self - .acked_features - .fetch_and(1u64 << VIRTIO_CONSOLE_F_SIZE, Ordering::AcqRel) - != 0 - { + if self.acked_features.load(Ordering::Acquire) & (1u64 << VIRTIO_CONSOLE_F_SIZE) != 0 { // Send the interrupt to the driver let _ = self.config_evt.write(1); }