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 8C1E04322E5; Mon, 17 Aug 2026 14:58:25 +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=1786978706; cv=none; b=YW+UMDxVvSbbFVeO5CBJzzNBVCLXo7Y06ZZZ3W4eHoZc+bd13I18K/lJA5bVhLDtvaNtO+eIeAmjQGVextk/Fw59aa5qiTThiY6wWISc0APz+v8nzn1imjPm2ys7xLFVegCT/tHtqA3+b7NYbnAb7kzBGXrYp4nlDMwsp0LUnBM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786978706; c=relaxed/simple; bh=EyZ7sBK7JGBcBVHk/wvSqXqzgwGCe+wShEnAqLIq77w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=siR6Fx81KqlgusMjRnVE74jJUiYHC27H9FVtbk4E/SdKnDtEW/G1cQznt8QLceNocv6SBGv+8lxDYdlxxvzOuz9gIIsQo6li+iRJfKbWfsidNA6rfNO0/TM6Fd3rLINenQf0bhpzrI3tVYwYnt8tV7xayQ9AiNCyCvX1G9BA8Y8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Y04cyi0a; 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="Y04cyi0a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E352C1F000E9; Mon, 17 Aug 2026 14:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786978705; bh=BSsTD344M0QiG7pOzgDRz00iXcdBzm8NmTKAkHV2ADw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y04cyi0aPoU5AMGXlV4XcPjC5GQdfa+V0hnxxQJT8wGvq/AGbPZVZ7WyI3KdLrhqD k4jeRtm/+mUF6CkII3l2VBZHO7ENJaurWfeyq2NCTlydU/Hne06R2C818LM5ZZwpOB xPKBup0t7utSrviTw3sSG3jqBdTWABg7lLfcQvuA= 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.6 130/156] vsock/virtio: read virtqueues under worker locks Date: Mon, 17 Aug 2026 15:34:24 +0200 Message-ID: <20260817132539.773835547@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132534.666299318@linuxfoundation.org> References: <20260817132534.666299318@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.6-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 @@ -257,12 +257,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; @@ -362,13 +363,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; @@ -487,13 +488,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 (;;) {