public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] pppoe: drop PACKET_OTHERHOST before skb_share_check()
@ 2025-06-23  3:34 Qingfang Deng
  2025-06-23 10:58 ` Guillaume Nault
  2025-06-24 23:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Qingfang Deng @ 2025-06-23  3:34 UTC (permalink / raw)
  To: linux-ppp, Michal Ostrowski, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

Align with ip_rcv() by dropping PACKET_OTHERHOST packets before
calling skb_share_check(). This avoids unnecessary skb processing
for packets that will be discarded anyway.

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
---
 drivers/net/ppp/pppoe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 68e631718ab0..410effa42ade 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -372,9 +372,6 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)
 	 * can't change.
 	 */
 
-	if (skb->pkt_type == PACKET_OTHERHOST)
-		goto abort_kfree;
-
 	if (sk->sk_state & PPPOX_BOUND) {
 		ppp_input(&po->chan, skb);
 	} else if (sk->sk_state & PPPOX_RELAY) {
@@ -418,6 +415,9 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
 	struct pppoe_net *pn;
 	int len;
 
+	if (skb->pkt_type == PACKET_OTHERHOST)
+		goto drop;
+
 	skb = skb_share_check(skb, GFP_ATOMIC);
 	if (!skb)
 		goto out;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] pppoe: drop PACKET_OTHERHOST before skb_share_check()
  2025-06-23  3:34 [PATCH net-next] pppoe: drop PACKET_OTHERHOST before skb_share_check() Qingfang Deng
@ 2025-06-23 10:58 ` Guillaume Nault
  2025-06-24 23:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Guillaume Nault @ 2025-06-23 10:58 UTC (permalink / raw)
  To: Qingfang Deng
  Cc: linux-ppp, Michal Ostrowski, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

On Mon, Jun 23, 2025 at 11:34:31AM +0800, Qingfang Deng wrote:
> Align with ip_rcv() by dropping PACKET_OTHERHOST packets before
> calling skb_share_check(). This avoids unnecessary skb processing
> for packets that will be discarded anyway.
> 
> Signed-off-by: Qingfang Deng <dqfext@gmail.com>
> ---
>  drivers/net/ppp/pppoe.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
> index 68e631718ab0..410effa42ade 100644
> --- a/drivers/net/ppp/pppoe.c
> +++ b/drivers/net/ppp/pppoe.c
> @@ -372,9 +372,6 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)
>  	 * can't change.
>  	 */
>  
> -	if (skb->pkt_type == PACKET_OTHERHOST)
> -		goto abort_kfree;
> -
>  	if (sk->sk_state & PPPOX_BOUND) {
>  		ppp_input(&po->chan, skb);
>  	} else if (sk->sk_state & PPPOX_RELAY) {
> @@ -418,6 +415,9 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
>  	struct pppoe_net *pn;
>  	int len;
>  
> +	if (skb->pkt_type == PACKET_OTHERHOST)
> +		goto drop;
> +
>  	skb = skb_share_check(skb, GFP_ATOMIC);
>  	if (!skb)
>  		goto out;

Agree. You can also refine the condition and reject broadcast packets
by using "if (skb->pkt_type != PACKET_HOST)". PPPoE session packets
should always be unicast.

Acked-by: Guillaume Nault <gnault@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] pppoe: drop PACKET_OTHERHOST before skb_share_check()
  2025-06-23  3:34 [PATCH net-next] pppoe: drop PACKET_OTHERHOST before skb_share_check() Qingfang Deng
  2025-06-23 10:58 ` Guillaume Nault
@ 2025-06-24 23:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-24 23:40 UTC (permalink / raw)
  To: Qingfang Deng
  Cc: linux-ppp, mostrows, andrew+netdev, davem, edumazet, kuba, pabeni,
	netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 23 Jun 2025 11:34:31 +0800 you wrote:
> Align with ip_rcv() by dropping PACKET_OTHERHOST packets before
> calling skb_share_check(). This avoids unnecessary skb processing
> for packets that will be discarded anyway.
> 
> Signed-off-by: Qingfang Deng <dqfext@gmail.com>
> ---
>  drivers/net/ppp/pppoe.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [net-next] pppoe: drop PACKET_OTHERHOST before skb_share_check()
    https://git.kernel.org/netdev/net-next/c/7eebd219feda

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-24 23:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-23  3:34 [PATCH net-next] pppoe: drop PACKET_OTHERHOST before skb_share_check() Qingfang Deng
2025-06-23 10:58 ` Guillaume Nault
2025-06-24 23:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox