Commit f0e77679 authored by Kuniyuki Iwashima's avatar Kuniyuki Iwashima Committed by sanglipeng
Browse files

llc: Don't drop packet from non-root netns.

stable inclusion
from stable-v5.10.188
commit a6f1988780a7c9e5f54a1d6d363db99e850106fc
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8KYFP

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a6f1988780a7c9e5f54a1d6d363db99e850106fc



--------------------------------

[ Upstream commit 6631463b ]

Now these upper layer protocol handlers can be called from llc_rcv()
as sap->rcv_func(), which is registered by llc_sap_open().

  * function which is passed to register_8022_client()
    -> no in-kernel user calls register_8022_client().

  * snap_rcv()
    `- proto->rcvfunc() : registered by register_snap_client()
       -> aarp_rcv() and atalk_rcv() drop packets from non-root netns

  * stp_pdu_rcv()
    `- garp_protos[]->rcv() : registered by stp_proto_register()
       -> garp_pdu_rcv() and br_stp_rcv() are netns-aware

So, we can safely remove the netns restriction in llc_rcv().

Fixes: e730c155 ("[NET]: Make packet reception network namespace safe")
Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 0ef3857a
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -163,9 +163,6 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
	void (*sta_handler)(struct sk_buff *skb);
	void (*sap_handler)(struct llc_sap *sap, struct sk_buff *skb);

	if (!net_eq(dev_net(dev), &init_net))
		goto drop;

	/*
	 * When the interface is in promisc. mode, drop all the crap that it
	 * receives, do not try to analyse it.