amt: drop unexpected multicast data
authorTaehee Yoo <ap420073@gmail.com>
Sun, 17 Jul 2022 16:09:09 +0000 (16:09 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 19 Jul 2022 10:37:02 +0000 (12:37 +0200)
AMT gateway interface should not receive unexpected multicast data.
Multicast data message type should be received after sending an update
message, which means all establishment between gateway and relay is
finished.
So, amt_multicast_data_handler() checks amt->status.

Fixes: cbc21dc1cfe9 ("amt: add data plane of amt interface")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/amt.c

index 8dc7b8f258c89e524aa6cd5d5ffc8e44f9d386ee..051e92ed56c0a104f7fc80bd6c1e042f1a02b41e 100644 (file)
@@ -2282,6 +2282,9 @@ static bool amt_multicast_data_handler(struct amt_dev *amt, struct sk_buff *skb)
        struct ethhdr *eth;
        struct iphdr *iph;
 
+       if (READ_ONCE(amt->status) != AMT_STATUS_SENT_UPDATE)
+               return true;
+
        hdr_size = sizeof(*amtmd) + sizeof(struct udphdr);
        if (!pskb_may_pull(skb, hdr_size))
                return true;