From nobody Mon Feb 9 00:20:05 2026 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3193E1FFC59 for ; Wed, 24 Dec 2025 00:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766536142; cv=none; b=E3JJB6HBOwl9y7iBp2U0BUVTWjS1XpPEjVg7tB0WoURgEpFALCVid5XlK/48eIX5nCbRI7CL//8rY2AcRgh67T3Jss3t2nhSpIBvxVdY4dP6kWjJPHdEIND18dFcl+BBcLCJli5BYuMBiCwHxl0P5ki73+jt+cJoPI6ehW3JWa4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766536142; c=relaxed/simple; bh=vD964Lj1wPSOw/16ssWykcRPX0KDwrhlz4wvw7+NTyw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NX8LoN7bxTf2MDx16UC8p2KWuu7kLxHK4RRhO3eFVvbDKJ2QELMA1a1t0sKOwG+cEnudvBwyLR+hI5xWPeigY90Ch8LD6++DdRIB8dCtEY17XSEeXPNM5bcChbN9h+k3eUOQUzPysrAL/9+t8/UTjZTEKKaqyt2vHamhoEWOQhE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YnXzcWtl; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YnXzcWtl" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-7b8eff36e3bso8610405b3a.2 for ; Tue, 23 Dec 2025 16:28:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766536138; x=1767140938; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=N0yb8kb1LkqAc5YpKYa8ha5gJygHDPK65XDs8oEX3qw=; b=YnXzcWtl9Pl43vI8tnxEnoOGUMS7QaGspcRV0eAgN4pw2e7MarPyYCeaJ+/ndqjgoX vBSYXsiZeJHpmA5X0HGHHWpjdHSSTETBvBpGhGS1k39K5KZNeZJr0EkuvUv/iTJKF2ng tRxFjZxVLqgCeOZ1xHPJeVLetUq23uBhvl0idV01SaMqUYLW9u1S5t67wLm92I9P5KzH 3eV3brW09Yh1fbTuoy+KxkCXGNO8cLVFBNGE78yhP/rJbsmGwUJ34xeikHlMwDZq//Gx 81FFhA8/jmLRDVZsyVT/oqBnul/mBUh2pFZBzxxcQstS4aXR4fWLcMsUxT72tprT3YQk W9zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766536138; x=1767140938; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=N0yb8kb1LkqAc5YpKYa8ha5gJygHDPK65XDs8oEX3qw=; b=mcXK1jJ1vQliLOiEAMFDxKlPIQYMCDktJ/vs5PEjtKEf6zyq7tWr948FlQOEA76Edg +kPcxwNWb5Umd4FvaMcWfEscw4IwOtD3GY56QwLNkaZVuSqMX6Zjt67yIMEDjqJQE23P nz5tJDmkHPRt1dRrIuWd6yJVA2HcAP6AmzpR0GrdpFAtfhWVoqw7odvrP3Ug11cRHSgg op8ZZWNiFQcKN7fOEmdm6wuDKx0crec2ZtqxCvZjDVSPz8k0Ggo2Yt5F18VHDmzdJ4K7 YiXAtBVR5/c4J3NLwmco/XyXV/6GH92QpL4swUmp13+yjX+nrLyAKDttJP00KXl/xUgu n6RQ== X-Gm-Message-State: AOJu0YzUQ6taAguPdQ5rU0XXGYQy3IWYbiiKrhfeD6JWcSHtFBuclLa2 CLYV+fvhotFXrSuWW5Oc4hMMTfOUFczeDgGYSSYmQMKd65wranCqVnVS X-Gm-Gg: AY/fxX5sn7O2XTl/1CX0HQqvuSzPxhUhXBihJUPD56+SIync4GnkbVG4w9xJPh3N5GZ fyj0ywoRg2nfag2N0xjTZP3xxb/Dtr13/kof8bkd5i8XYFVN9NPfMpw3tJLIHzakGcL1Dn94lyf KZrBrSxjXXiMSTEsvsL6vlkmVFnNrR9p7ysnee4T0JSwJYGB5lmfjoylFOYB8o5Eb+vrq7cSdDb mYAjJCZWjdPcnp2mzOFHMC4JTjTO/7NjZrUFfWWvdFvBK7OZ+ahI22SD/CjRishj4kZLvepxjst oVxBjBV9ZaFfyijAxpy+floh+gJu7efWe6UXsJqPsIdJPR5PJdzjxnSvZZSwp3XDrrDF5yDo9za F5mz2UX4uMlyv+gm8RIt+3FrvyaxNBKPQcX25nb8XIrMh75kwBkd5s5ZJ2GT5V5vbkHXIFQhCzz P6zZZcVMqZBeODp+q2+tc= X-Google-Smtp-Source: AGHT+IFdIc/UDuq+YWFWwYE+rGSg4T/7sFob5YN3Yow0dtG/wPBVPu2NKHMvyvYhCHAoi2nwyYlnEw== X-Received: by 2002:a05:6a00:418a:b0:7e8:450c:619b with SMTP id d2e1a72fcca58-7ff66a6d701mr13217930b3a.50.1766536138262; Tue, 23 Dec 2025 16:28:58 -0800 (PST) Received: from localhost ([2a03:2880:2ff:8::]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7ff7a93ab3csm14729340b3a.7.2025.12.23.16.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 16:28:57 -0800 (PST) From: Bobby Eshleman Date: Tue, 23 Dec 2025 16:28:37 -0800 Subject: [PATCH RFC net-next v13 03/13] virtio: set skb owner of virtio_transport_reset_no_sock() reply Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251223-vsock-vmtest-v13-3-9d6db8e7c80b@meta.com> References: <20251223-vsock-vmtest-v13-0-9d6db8e7c80b@meta.com> In-Reply-To: <20251223-vsock-vmtest-v13-0-9d6db8e7c80b@meta.com> To: Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Stefan Hajnoczi , "Michael S. Tsirkin" , Jason Wang , =?utf-8?q?Eugenio_P=C3=A9rez?= , Xuan Zhuo , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Bryan Tan , Vishnu Dasa , Broadcom internal kernel review list , Shuah Khan , Long Li Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org, kvm@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kselftest@vger.kernel.org, berrange@redhat.com, Sargun Dhillon , Bobby Eshleman , Bobby Eshleman X-Mailer: b4 0.14.3 From: Bobby Eshleman Associate reply packets with the sending socket. When vsock must reply with an RST packet and there exists a sending socket (e.g., for loopback), setting the skb owner to the socket correctly handles reference counting between the skb and sk (i.e., the sk stays alive until the skb is freed). This allows the net namespace to be used for socket lookups for the duration of the reply skb's lifetime, preventing race conditions between the namespace lifecycle and vsock socket search using the namespace pointer. Reviewed-by: Stefano Garzarella Signed-off-by: Bobby Eshleman --- Changes in v11: - move before adding to netns support (Stefano) Changes in v10: - break this out into its own patch for easy revert (Stefano) --- net/vmw_vsock/virtio_transport_common.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio= _transport_common.c index fdb8f5b3fa60..718be9f33274 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1165,6 +1165,12 @@ static int virtio_transport_reset_no_sock(const stru= ct virtio_transport *t, .op =3D VIRTIO_VSOCK_OP_RST, .type =3D le16_to_cpu(hdr->type), .reply =3D true, + + /* Set sk owner to socket we are replying to (may be NULL for + * non-loopback). This keeps a reference to the sock and + * sock_net(sk) until the reply skb is freed. + */ + .vsk =3D vsock_sk(skb->sk), }; struct sk_buff *reply; =20 --=20 2.47.3