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 4C2F12D8DDF; Mon, 17 Aug 2026 14:00:53 +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=1786975254; cv=none; b=syRZwYG+i6mRdldcT+K575yKTfRkUbKt0yY0ESsd2ql29L6/4yxVepTlo6w9wl9x5kwhTZ5l6w1BE7Wp33J0cnzgroHl50x7lx65DSjnZMXtZM5IObKwEvaYkSbZa1hyXF5Bcc9ejPNbNF11Jrv1ANSE631z47R7gH0vUoic7Uk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786975254; c=relaxed/simple; bh=g7CELtEuSh1xRML+CBsszn3EjBtebKlM8J3K0SmtIoQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o8E0sIDebzgFOA3+HGzFoFj6TMCBjYAsiJkaI6P/i1g+7l5war730KT//YtVjXl1vlAUT5tJ7Vl3O0wCxcM6dDXDLy+2DB29aUN7b71LhmyQF4YmNWG6Id2Fo2upXEGoYvy1JsvXWBCSDA80GyLFjdADqbS8qg+KgBoS3PzjJII= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KTtHKWhb; 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="KTtHKWhb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4A831F000E9; Mon, 17 Aug 2026 14:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786975253; bh=vp7hst5DUmXIKF5X9PF8JEo0ynBwuomZ2GtM66wBXjs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KTtHKWhb7q2hrTHNNhG33Fe2AsAPqN3DXrpthG079ALx4iGEndiufpiA4WNtHWeny mQuql40qexCmxUz5FFJeq1xuH1YnKW44aVAAf74P+Ds9god+Q8syidHH30aJ4iWEiA ZrbGHkDjT9pxpU2l6B+xNVoGDVDpcq/3Jr9scAWI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xiang Mei , Weiming Shi , Bobby Eshleman , Jakub Kicinski Subject: [PATCH 6.18 216/250] vsock/virtio: read virtqueues under worker locks Date: Mon, 17 Aug 2026 15:32:57 +0200 Message-ID: <20260817132545.357560245@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132536.466235697@linuxfoundation.org> References: <20260817132536.466235697@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Weiming Shi commit ebac8f6b1ef0e9278afe204b8692a7479988dace upstream. Commit bd50c5dc182b ("vsock/virtio: add support for device suspend/resume") made the *_run flags transition from false to true when restore installs replacement virtqueues. The RX, TX and event workers read their virtqueue before locking and checking the corresponding flag, so a worker delayed across freeze and restore can observe the replacement queue's running state while retaining a pointer to the deleted queue. Read each virtqueue under its mutex after checking the run flag, keeping the pointer and state in the same queue generation. Fixes: bd50c5dc182b ("vsock/virtio: add support for device suspend/resume") Cc: stable@vger.kernel.org Reported-by: Xiang Mei Link: https://lore.kernel.org/r/20260727035804.1860862-1-bestswngs@gmail.com Signed-off-by: Weiming Shi Reviewed-by: Bobby Eshleman Link: https://patch.msgid.link/e79f68ad9284c983364fc3ac46904b6d9ef50231.1785352330.git.bestswngs@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/vmw_vsock/virtio_transport.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/net/vmw_vsock/virtio_transport.c +++ b/net/vmw_vsock/virtio_transport.c @@ -343,12 +343,13 @@ static void virtio_transport_tx_work(str struct virtqueue *vq; bool added = false; - vq = vsock->vqs[VSOCK_VQ_TX]; mutex_lock(&vsock->tx_lock); if (!vsock->tx_run) goto out; + vq = vsock->vqs[VSOCK_VQ_TX]; + do { struct sk_buff *skb; unsigned int len; @@ -448,13 +449,13 @@ static void virtio_transport_event_work( container_of(work, struct virtio_vsock, event_work); struct virtqueue *vq; - vq = vsock->vqs[VSOCK_VQ_EVENT]; - mutex_lock(&vsock->event_lock); if (!vsock->event_run) goto out; + vq = vsock->vqs[VSOCK_VQ_EVENT]; + do { struct virtio_vsock_event *event; unsigned int len; @@ -614,13 +615,13 @@ static void virtio_transport_rx_work(str container_of(work, struct virtio_vsock, rx_work); struct virtqueue *vq; - vq = vsock->vqs[VSOCK_VQ_RX]; - mutex_lock(&vsock->rx_lock); if (!vsock->rx_run) goto out; + vq = vsock->vqs[VSOCK_VQ_RX]; + do { virtqueue_disable_cb(vq); for (;;) {