From nobody Sun Feb 8 18:48:46 2026 Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (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 6B3903074AE for ; Fri, 16 Jan 2026 21:29:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768598947; cv=none; b=MaXuWBcz96jWt9OjbP0sFkDFW2DWMMG9f4GMiwFM1wCtIDXbDthNyQgsud21rbMg4aXmrMtae9rwO1xo/Ru+1eY+UzroKx1Ks3lD0hmDrnlJ9ohvsC29WDxme/nm00ox17q82cHqT23Fn0S1EgKlqX8Dapp+wu0wQ9unQvZWPxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768598947; c=relaxed/simple; bh=vD964Lj1wPSOw/16ssWykcRPX0KDwrhlz4wvw7+NTyw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lP3gcQ3dUmsbHFzfSL01ZmuODQz9DylhY690dSD2DwgdaFy/RzwXtyMcvUlsP4Im2MM8Z/HyZMhkXiumcLJh2+Ch3I7YmArJjcSWtaJbKBVH7HwBiAduoCtpGb4CtNBja6Vi3Cvz7uWbqKZUdRwcgRAN2zi2pNEj/n5dWZ8aGN8= 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=BqwvUnlN; arc=none smtp.client-ip=209.85.128.175 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="BqwvUnlN" Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-78e6dc6d6d7so25868687b3.3 for ; Fri, 16 Jan 2026 13:29:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768598944; x=1769203744; 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=BqwvUnlNPCKikTxYdL+5w8XOT82LgQ0+ssDXjKCFsQOiOEKeiqpdAFz8/CE93RQl5v /GVKF15nii0G6eKA5oQ8s22PMA7hztwgG5qgQDLIW3i5knksl747rL2nTy6hhVXHGHFy vQNhM17LwHRwZEtAqwkm6d5i5P1xIbrGPD8eDjNZCCEMNSMK8p6XUwSj1NxI0l7Ym5ZV S3Lxo/tw3O96guydkObG3nLyxKn7r9U0oaRjAvCLmJ8qQ1uCYYurSraB70Sj03AnAvXI WkOkTK0q3z508sBiWTyQ8VqmEyUTD1pndtwVGYmkBN5icbbVkvQOfNR9KCBiKYMzS1wK NxkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768598944; x=1769203744; 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=bPE88KxT4ndC7QxJ4M7AgKWK+gcxsRsCGocwXZ2La1LTC43BC8N5MT8AMjp323iLYq 7SC+ZYWnGE9PVzGjt48+0GbmBb00eGj0Rhr++xYD7zUUjyvL2NyiU9BHA8aeJTuQXGua w4I0/7A/dob8bmhzn6VhEqZqT23B99s8HQeeRN1kHv7BWPAi2o0T9BPDjsAzt72utzbt mDgp0yGvv/yavorcZyL9CoYT2tjGZCTfVBGR8IDs/ukfP23h8/A99Hen7BaCchr5FXij RTZcdjFtyMVBW93VXPlNcn61PBfiBkF30fP2v1Ue7pM3ZN2cQWVG1ir6v7jBs7HT9ExE 2uBA== X-Gm-Message-State: AOJu0Yzui9Zgf7d5qYMkH+KM/K3mEOka/rb/RQnbQJMSzyinVwNEkOPl PvzPh+6xlop9AHbDuuN8b7v4XVGqio0fBYLIcCbTAwMK6XCS6xU1FYVP X-Gm-Gg: AY/fxX5i512RHME3XRnJ8Ys886zKdHf9fDQ106+NADpObT+UupyU/UKwMkYquJFeUmb wgtwrepuIci6vo3TkzkdwNkqo35hkLje+SLUNg6yPPtOYGEkHPs/avUCV0HXcEK4t5USXJq+NrK mqAyVmIrHDonxYAu0hobadxLmtIO2QC6w2UkP01nkykz6+sRwvedFHwu5xVlM3ulsFMbhpNGyCk dqMVPO+wNATyi1UOk+HAlkrYv6iL2RScLGgdh/s4nZb6AcPHEUZvVh2KNcskatrfZCwU7BS9DZf /ukbNZQ6Rkn1Dby3J4EZFqn3JbCAzpAdDNqI+Eb445SWaHvxZX15fGdfWdFjEny9ezmKlpElacj qS1bPaATQ7SeSZq8L121f1KONwrJ3MysMhDFWw6Zzv/L2QoaBe2Zyy/s0jJHUMM6pqkJr+TVBEB Lc5piGBCNejA== X-Received: by 2002:a05:690c:39d:b0:78c:2916:3f0a with SMTP id 00721157ae682-793c66b8eb1mr33268517b3.7.1768598944439; Fri, 16 Jan 2026 13:29:04 -0800 (PST) Received: from localhost ([2a03:2880:25ff:5d::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-793c66c729fsm13186297b3.12.2026.01.16.13.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jan 2026 13:29:04 -0800 (PST) From: Bobby Eshleman Date: Fri, 16 Jan 2026 13:28:42 -0800 Subject: [PATCH net-next v15 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: <20260116-vsock-vmtest-v15-2-bbfd1a668548@meta.com> References: <20260116-vsock-vmtest-v15-0-bbfd1a668548@meta.com> In-Reply-To: <20260116-vsock-vmtest-v15-0-bbfd1a668548@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 , Jonathan Corbet 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 , linux-doc@vger.kernel.org, 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