diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2023-07-18 19:41:49 +0200 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-07-20 10:46:28 +0200 |
commit | 9b64e93e83c2145a750e780198b41d612e3dfa5d (patch) | |
tree | bf22126aea58de5eb58b3edcf5b20cdd5e6fcef6 /net/nfc/digital_dep.c | |
parent | net: ethernet: mtk_eth_soc: always mtk_get_ib1_pkt_type (diff) | |
download | linux-9b64e93e83c2145a750e780198b41d612e3dfa5d.tar.xz linux-9b64e93e83c2145a750e780198b41d612e3dfa5d.zip |
llc: Check netns in llc_dgram_match().
We will remove this restriction in llc_rcv() soon, which means that the
protocol handler must be aware of netns.
if (!net_eq(dev_net(dev), &init_net))
goto drop;
llc_rcv() fetches llc_type_handlers[llc_pdu_type(skb) - 1] and calls it
if not NULL.
If the PDU type is LLC_DEST_SAP, llc_sap_handler() is called to pass skb
to corresponding sockets. Then, we must look up a proper socket in the
same netns with skb->dev.
If the destination is a multicast address, llc_sap_handler() calls
llc_sap_mcast(). It calculates a hash based on DSAP and skb->dev->ifindex,
iterates on a socket list, and calls llc_mcast_match() to check if the
socket is the correct destination. Then, llc_mcast_match() checks if
skb->dev matches with llc_sk(sk)->dev. So, we need not check netns here.
OTOH, if the destination is a unicast address, llc_sap_handler() calls
llc_lookup_dgram() to look up a socket, but it does not check the netns.
Therefore, we need to add netns check in llc_lookup_dgram().
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/nfc/digital_dep.c')
0 files changed, 0 insertions, 0 deletions