]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pppoe: drop PACKET_OTHERHOST before skb_share_check()
authorQingfang Deng <dqfext@gmail.com>
Mon, 23 Jun 2025 03:34:31 +0000 (11:34 +0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 24 Jun 2025 23:37:02 +0000 (16:37 -0700)
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>
Acked-by: Guillaume Nault <gnault@redhat.com>
Link: https://patch.msgid.link/20250623033431.408810-1-dqfext@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ppp/pppoe.c

index 68e631718ab0b675c6ba98dcac4f8468f3d2e21e..410effa42adef0f8dd2adec59dfe9f7d9f4a9339 100644 (file)
@@ -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;