linux/drivers/vhost
Kohei Enju 33d390ee6d vhost_net: fix sleeping with preempt-disabled in vhost_net_busy_poll()
[ Upstream commit e08a9fac5c ]

syzbot reported "sleeping function called from invalid context" in
vhost_net_busy_poll().

Commit 0308813724 ("vhost_net: basic polling support") introduced a
busy-poll loop and preempt_{disable,enable}() around it, where each
iteration calls a sleepable function inside the loop.

The purpose of disabling preemption was to keep local_clock()-based
timeout accounting on a single CPU, rather than as a requirement of
busy-poll itself:

https://lore.kernel.org/1448435489-5949-4-git-send-email-jasowang@redhat.com

From this perspective, migrate_disable() is sufficient here, so replace
preempt_disable() with migrate_disable(), avoiding sleepable accesses
from a preempt-disabled context.

Fixes: 0308813724 ("vhost_net: basic polling support")
Tested-by: syzbot+6985cb8e543ea90ba8ee@syzkaller.appspotmail.com
Reported-by: syzbot+6985cb8e543ea90ba8ee@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/69e6a414.050a0220.24bfd3.002d.GAE@google.com/T/
Signed-off-by: Kohei Enju <kohei@enjuk.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-06-01 17:35:40 +02:00
..
iotlb.c vhost: handle error while adding split ranges to iotlb 2022-04-08 14:24:12 +02:00
Kconfig vhost_vdpa: implement IRQ offloading in vhost_vdpa 2020-08-05 11:08:42 -04:00
Makefile vhost: introduce vDPA-based backend 2020-04-02 10:41:40 -04:00
net.c vhost_net: fix sleeping with preempt-disabled in vhost_net_busy_poll() 2026-06-01 17:35:40 +02:00
scsi.c vhost-scsi: Fix log flooding with target does not exist errors 2025-08-28 16:24:11 +02:00
test.c tools/virtio: Add --reset 2020-06-22 12:34:21 -04:00
test.h tools/virtio: Add --reset 2020-06-22 12:34:21 -04:00
vdpa.c vdpa: Sync calls set/get config/status with cf_mutex 2026-01-19 13:09:34 +01:00
vhost.c vhost: fail early when __vhost_add_used() fails 2025-08-28 16:24:22 +02:00
vhost.h vhost: support PACKED when setting-getting vring_base 2023-06-14 11:13:09 +02:00
vringh.c vringh: don't use vringh_kiov_advance() in vringh_iov_xfer() 2023-10-10 21:59:05 +02:00
vsock.c vhost/vsock: improve RCU read sections around vhost_vsock_get() 2026-01-19 13:09:48 +01:00