From nobody Sun Feb 8 17:36:18 2026 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (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 E80A030E0F5 for ; Tue, 13 Jan 2026 03:12:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768273980; cv=none; b=GxubaME0vBc1UyS0t8L8M/w799HBAFNgeE3k1QhDs/lkb5kIP11RLdlkU11YocNs+kqvdKIh4/+6c1u6eItq0yXDaW8fdB46XFg3qOv8TFy1vM1p6LPHAqtiOCQrbqiFOLqn8lJD/47VyV9P7FrpOvS9flDWW+vQRpVbmPnN+dk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768273980; c=relaxed/simple; bh=vD964Lj1wPSOw/16ssWykcRPX0KDwrhlz4wvw7+NTyw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qamtTZQUUww56htk9GMzh+/tgYzhyyj/EghWyUh4mGHFF9+FPiH1WFJn8G4+mt8xQu1d5rWLHhETbsfvYah3Oc5tHCM2ak4/FyyIS6ZIS1FPVn2RfaFIKYyg0SKqAzdHyoTZJSIlvZxy/K2QKqne+X4eTEa9KrD1bT29GiG60PY= 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=irPpLPU2; arc=none smtp.client-ip=209.85.128.173 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="irPpLPU2" Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-7904a401d5cso75106527b3.3 for ; Mon, 12 Jan 2026 19:12:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768273978; x=1768878778; 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=irPpLPU2XzmI+2sVaJdVcskUb/Tttp2FaeL030WnEqu/DYNJPFMCTG7PrKIJL0OCIy Pgxz1DBwFphhLICgm19CHrv/fo+K3Q9MMMI70K+wADSmbbeM4o090UvrridrdEGg5ZpZ 7hOqPkOHz9jZFErUvSC19JrSRL08gNsE3EelM43J3hejO2WbjvO6tHNbmXGQYZG1DPFb xgV3doQwigaiGiNnu40vkPsFTVeNCoEkfmDR2H7JuwqCLAbVHA3Dyp/trJkaE6K7wIrX Lq4D5m5tB/SndBie0zEwcAHsb4obYWMyHbb9oiXOgyuwzzh3tVhtFnARjTU4jwG374r5 a9Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768273978; x=1768878778; 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=mpi43T0V1+1a1/DTSW3OGQJIBJT1NyWhABOb2cTIw/dQJ9N399+zGK1qqq+QOz2WVF 5tN6f9ETYANEzrBmv+CdsgGs/kmxpOGjuZ54VkmHum+lmzXuonWIh8v9t957/+YpJLpt kwbRT8C2ZxXNVNzn3VgfrJ27fBrQEztUftG7yEIHc66Aaj+jWg6QSBMPG7DEaUChlJhp Qw7Ij27B4wFKG3jz9wX1+gyj4X9nUkwjUBOYzvXn7FFt0KQuyve4SBG+qHhpTinQHCiX srpuLC1YyHyrvLetL9duUyWr3rFkX2BaiHJ8VjtFBp6qpyaapjsvBExK2v00CXWx2fQh IcHA== X-Gm-Message-State: AOJu0YxnwitgAhffkQXdjBPWd4BdSQWJ28HE5cj2rK6a4Uhh9aKyqX9p utkR374kJqExpaD4y9w7Akbj0bEN+7qJo44UguM78KKxu04a71sMr2uw X-Gm-Gg: AY/fxX6+cPOr9h0AF5zoym7vWx8HMHGB1nOslrGirlfRIfCyQD73qeyw+ZbFH2tmG+u vDUaBejwpjdwfOaUMD+SvoaKOxW0IW07N5+f9u9o89dJ/Mby2HbRSYXWGkGttCjYZXTl1hUJ2iV ND9AgTfVgjfMXHWcXvt4J2Sa2wyO0RDIICdFe+vP84PO2lRYnhwjB9Dt+EOfyqC/a5yPPsxDZlW sCHqzyc6gPcbCW4tLviQLcZn9QRFWaKZClYZfJp/mmciFUVAQHjB6Pej1DsrCU3fT4GNt9c45PN Xlyye4VFlm4LNxQiHDc3rDAESPjVJ+kQ5tMnNYiG6CVPIvUXAcvw2azdn6JNDaUxpIdVMDZFTkR nVThuJqDZHj0qhKwYjMdJv1Jh2iiqK5kssGB0EpyiSL8nJeS/NIHzTKzCQsw2kB7LEOwmtkhZ9h CqTvXRLUUX0A== X-Google-Smtp-Source: AGHT+IHcF7Zmu1veaf8u0eg/Kbb68KxKW7zWjXp5XrByj/JKfJyEyOkbbQZuZ3nalmLjzPkGlfdNOw== X-Received: by 2002:a05:690c:6285:b0:78c:2473:ae79 with SMTP id 00721157ae682-790b56a66bemr171959117b3.39.1768273977917; Mon, 12 Jan 2026 19:12:57 -0800 (PST) Received: from localhost ([2a03:2880:25ff:58::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-790aa592cdcsm75715147b3.25.2026.01.12.19.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jan 2026 19:12:57 -0800 (PST) From: Bobby Eshleman Date: Mon, 12 Jan 2026 19:11:11 -0800 Subject: [PATCH net-next v14 02/12] 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: <20260112-vsock-vmtest-v14-2-a5c332db3e2b@meta.com> References: <20260112-vsock-vmtest-v14-0-a5c332db3e2b@meta.com> In-Reply-To: <20260112-vsock-vmtest-v14-0-a5c332db3e2b@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