From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95BDF3D88FC; Wed, 20 May 2026 18:21:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301289; cv=none; b=nuGz52yNcKhQRiMLY31eHFBn0XUyU56GvMvGyzklyqaqyiyP/FiF3qHc0LxfqaeuE5NAwcmCVHzjFLhiPRumhLoxUlx56lxCVr0JO7Yn4tIRmx7hGGp/3zZhBp600CscfQaTjK6KtEM+8ghT5YTgdNbSQWZkq3EeQHGfwTgHXhw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301289; c=relaxed/simple; bh=YEExgy2NyETneLlhCCyAJFX13OkJ8ycFq2l7Fco7gdk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZCpv93o2/62e56ezBe8UVo/m34F7Lfhll6JV2+o3gteJguxd8EAuDvwClsoZtzeO8BhNeisIuCZW3sO8dYJMJQIt5xOO3FAOrfeigqeUY7pqchoY9wJQjuVWTmRkhpZAtmLqS6uGXkYLzLCSDkMIlYz9SqjDQet9/lo21C0KQTg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LUQ8ee80; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="LUQ8ee80" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 087871F000E9; Wed, 20 May 2026 18:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779301288; bh=DZfSutgE++7rXgmQAIPoAvVkKDmNpdL+6w3503E2UNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LUQ8ee80XhwTJ3izHz9r/kGL7xOiK/j5wM6o8xQ1UGK0uKLYRfaiwpawqGalRuOSg zPzccLYNAivVVEa5/Yw2OUJ2r1y4fnbCUuGYOvefe/rc005/hsTXHiKbm05+La9Nlg 4IzSYWPPvHvpM5KLLl6JCsXMndXEUbWuTs0RVwz0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+6985cb8e543ea90ba8ee@syzkaller.appspotmail.com, Kohei Enju , "Michael S. Tsirkin" , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 498/666] vhost_net: fix sleeping with preempt-disabled in vhost_net_busy_poll() Date: Wed, 20 May 2026 18:21:49 +0200 Message-ID: <20260520162122.054391219@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162111.222830634@linuxfoundation.org> References: <20260520162111.222830634@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kohei Enju [ Upstream commit e08a9fac5cf8c3fecf4755e7e3ac059f78b8f83d ] syzbot reported "sleeping function called from invalid context" in vhost_net_busy_poll(). Commit 030881372460 ("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: 030881372460 ("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 Acked-by: Michael S. Tsirkin Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/vhost/net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index aff4ec7835628..3ad1a6f4ef965 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -549,7 +549,7 @@ static void vhost_net_busy_poll(struct vhost_net *net, busyloop_timeout = poll_rx ? rvq->busyloop_timeout: tvq->busyloop_timeout; - preempt_disable(); + migrate_disable(); endtime = busy_clock() + busyloop_timeout; while (vhost_can_busy_poll(endtime)) { @@ -566,7 +566,7 @@ static void vhost_net_busy_poll(struct vhost_net *net, cpu_relax(); } - preempt_enable(); + migrate_enable(); if (poll_rx || sock_has_rx_data(sock)) vhost_net_busy_poll_try_queue(net, vq); -- 2.53.0