Commit 7eebd219 authored by Qingfang Deng's avatar Qingfang Deng Committed by Jakub Kicinski
Browse files

pppoe: drop PACKET_OTHERHOST before skb_share_check()



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: default avatarQingfang Deng <dqfext@gmail.com>
Acked-by: default avatarGuillaume Nault <gnault@redhat.com>
Link: https://patch.msgid.link/20250623033431.408810-1-dqfext@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c9e78afa
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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;