From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796406957; b=lV79hebZ92bDScFhmVgTnJucFI/egGYyUNK2ss7Bsa1h+qioFmClB0+yBoF/8rM/TpSX qa+dpvCJyRSAtnj1aIL95nfvyHtBn2tXqz7HGl2AhJhmCG9eZiTM2xttHVtfEBLUxgT4w U9F8p/b62MsI/LSxbKs3CmPpRNSg33DDV/zSVIX8faBJGRYYmr+xCGo9816a2XfaKnnNr EX3GhdhLQwMspqPQI6ktL7Q+ra5UvViERPrz+oq97B86mAmdQPIfjQK3A/9+0JJn4nTTv Mn3IiBFiDL8cHbSBplnrygHhwdOJ8N+BGQyLDUaVTztxZXZMu1W0iOOsaZM2lp3jsXw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796406957; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=D8I8oTNf0zhOX6+fvKWfJjlRDfSgFOnvGsg24ZFnVbY=; b=pmnAr/wd67PgEpC7YOq4sfooWcNVGBWkgmyNAPrHM59pvmJGW+UMJ7A6BcZwnqTqkWZ8 mqzf8SOyZrc5YAzkcWG7TvFKdfLUQf1GnvaJybXD5TfrfwevZJP1Vchl71/BwUhlsAXBU l15R5LoC3xX2RXzW6pmKRCmb07uuuNgoHIjy13IETuFRfroPh79YCL8h09LKuUFISeBa4 jnjllBD05FW/zfBBExOQ67Yu6ooOu8lcoTZ+8Qh88oVrYPZ0TLCKpKbhWkrj5k49Fu06T UERyphmidE4+0/uioq+fPpTL1yR429po0zfJCKhk+LGWWq2E0/5FauSTWi+NDqnjSyg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=G8iOvrK8; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5F27606A335 for ; Fri, 4 Dec 2026 17:55:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=G8iOvrK8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 932201F00936; Fri, 4 Dec 2026 17:55:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796406956; bh=D8I8oTNf0zhOX6+fvKWfJjlRDfSgFOnvGsg24ZFnVbY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=G8iOvrK8LDO2zwzi6c/5+Kb2lMaiAYCQHt7p+nFeBH/mmRXLeddk0AWLlnKML/1jg 4XnDs1F/egmyrYB6PDoHkYhJzqYgwOMrhWFmxFUpjYPPmt3iZ72039fmGJyyzQIebf nxUjn8Zvk5/igHoCkCbAq8nVxawsOJ0Vxja9NEQ5GCKXO8hPJ3/dPI0xfk6oZ8cpSx XS4KYKgKgpenGDgUNMsmqZRO6umKNVEeGMOpm6eyGWrPrUcNxrINkJ1b+Rj9UGxpQa kV03LWtSYmmnW4yRHd60OzeZ+kdnvvMt3wLFKqE64++kuCK+Ki87XnttTfjZB5O/Ih DEYetAqX0psgg== Subject: Re: [PATCH net-next v14 6/8] hsr: Assign a socket for cloned skbs From: netdev-bot+sashiko@kernel.org To: bigeasy@linutronix.de Cc: netdev@vger.kernel.org, j-rameshbabu@ti.com, andrew+netdev@lunn.ch, danishanwar@ti.com, d-qiu@ti.com, davem@davemloft.net, fmaurer@redhat.com, kuba@kernel.org, neelima@ti.com, pabeni@redhat.com, praneeth@ti.com, pratheesh@ti.com, richardcochran@gmail.com, horms@kernel.org, vigneshr@ti.com, willemdebruijn.kernel@gmail.com, daniel.machon@microchip.com, edumazet@kernel.org Date: Fri, 04 Dec 2026 17:55:55 +0000 Message-ID: <179640695518.3146.18120858440869969765@kernel.org> In-Reply-To: <20261203-hsr_ptp-v14-6-1511ffd4c362@linutronix.de> References: <20261203-hsr_ptp-v14-6-1511ffd4c362@linutronix.de> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 1 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] A PRP device now delivers a TX timestamp for a PTP frame only when has_hsr_header=1; with has_hsr_header=0 it silently drops it. - [Low] Both call sites added by this patch give clones a socket only when the frame came through the new PTP inline header. -- hsr: Assign a socket for cloned skbs This patch gives skbs cloned in hsr_create_tagged_frame() and in the has_hsr_header branch of hsr_forward_do() the socket of the original skb. skb_clone() clears skb->sk and hsr_forward_skb() frees the original. Without this change, skb_tstamp_tx() has no socket to report the requested TX timestamp to. > diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c > index 1d1d75ed8cd06..9cb3297a8640a 100644 > --- a/net/hsr/hsr_forward.c > +++ b/net/hsr/hsr_forward.c [ ... ] > @@ -347,6 +348,9 @@ struct sk_buff *hsr_create_tagged_frame(struct hsr_frame_info *frame, > if (!skb) > return NULL; > > + if (frame->req_tx_port != HSR_PT_NONE && frame->skb_std->sk) > + skb_set_owner_w(skb, frame->skb_std->sk); > + [Severity: Low] This isn't a bug, but the subject ("hsr: Assign a socket for cloned skbs") and the last paragraph ("Assign the socket of the original skb to the clone") suggest that every HSR clone is now owned by a socket. The socket is only assigned when the frame came in through the new PTP inline header. Normal HSR traffic still gets clones with no owner. Could the changelog mention that restriction? The two sites also use different conditions. This one checks frame->req_tx_port, while the hsr_forward_do() site below checks frame->has_hsr_header. Both are meant to cover frames from the PTP inline header. That only works because hsr_ptp_parse_header() is the only place that sets either field. It rejects frames without skb->sk, and it rejects any req_tx_port other than HSR_PT_SLAVE_A or HSR_PT_SLAVE_B: net/hsr/hsr_device.c:hsr_ptp_parse_header() { ... if (!skb->sk) return -EINVAL; ... *has_hsr_header = !!hsr_inline_hdr->has_hsr_header; *req_tx_port = hsr_inline_hdr->req_tx_port; if (*req_tx_port != HSR_PT_SLAVE_A && *req_tx_port != HSR_PT_SLAVE_B) return -EINVAL; ... } If a later change sets one of these fields without the other, the two checks would no longer agree. Would a single shared condition be easier to keep consistent? > if (port->dev->features & NETIF_F_HW_HSR_TAG_INS) > return skb; > [ ... ] > @@ -582,6 +586,8 @@ static void hsr_forward_do(struct hsr_frame_info *frame) > */ > if (frame->has_hsr_header && frame->skb_std) { > skb = skb_clone(frame->skb_std, GFP_ATOMIC); > + if (skb && frame->skb_std->sk) > + skb_set_owner_w(skb, frame->skb_std->sk); > goto inject_into_stack; > } [Severity: Medium] The changelog says: This does not consider PRP part of the stack. The specification says that PTP-PRP packets do not have the RCT therefore these packets can be sent directly from userland skipping the stack. Is that accurate? This branch of hsr_forward_do() runs for both HSR and PRP devices. Neither hsr_dev_xmit() nor hsr_ptp_parse_header() checks hsr->prot_version. A PRP device therefore accepts struct hsr_inline_header with req_tx_port set to port A or B. For ETH_P_1588 it also requires that header. With has_hsr_header=1 on a PRP device, prp_fill_frame_info() finds no RCT and calls handle_std_frame(). That sets skb_std, so this branch is taken. The clone gets skb_set_owner_w() and the timestamp reaches the user. With has_hsr_header=0 on the same device, hsr_forward_do() calls hsr->proto_ops->create_tagged_frame(), which is prp_create_tagged_frame(): net/hsr/hsr_forward.c:prp_create_tagged_frame() { ... } else if (port->dev->features & NETIF_F_HW_HSR_TAG_INS) { return skb_clone(frame->skb_std, GFP_ATOMIC); } skb = skb_copy_expand(frame->skb_std, skb_headroom(frame->skb_std), skb_tailroom(frame->skb_std) + HSR_HLEN, GFP_ATOMIC); return prp_fill_rct(skb, frame, port); } Neither of these paths assigns an owner. skb_tstamp_tx() then has no socket, so the requested timestamp is silently lost. The frame also gets an RCT appended, and the changelog says PTP-PRP frames should not carry one. After this patch, hsr_create_tagged_frame() and the shared has_hsr_header branch both set the owner for req_tx_port frames. prp_create_tagged_frame() is the only req_tx_port transmit path that doesn't. On PRP, whether the timestamp arrives therefore depends on the HSR-named has_hsr_header flag. Should hsr_ptp_parse_header() reject the inline header on PRP_V1 devices? Alternatively, should prp_create_tagged_frame() handle req_tx_port frames the same way hsr_create_tagged_frame() now does? If neither, could the changelog at least describe what happens on PRP? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203-hsr_ptp-v14-0-1511ffd4c362%40linutronix.de