From: Guillaume Nault <gnault@redhat.com>
To: Qingfang Deng <dqfext@gmail.com>
Cc: linux-ppp@vger.kernel.org,
Michal Ostrowski <mostrows@earthlink.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] pppoe: drop PACKET_OTHERHOST before skb_share_check()
Date: Mon, 23 Jun 2025 12:58:40 +0200 [thread overview]
Message-ID: <aFkzYKBU/c8aub5Q@debian> (raw)
In-Reply-To: <20250623033431.408810-1-dqfext@gmail.com>
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>
next prev parent reply other threads:[~2025-06-23 10:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2025-06-24 23:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aFkzYKBU/c8aub5Q@debian \
--to=gnault@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ppp@vger.kernel.org \
--cc=mostrows@earthlink.net \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox