tipc: discard MSG_CRYPTO msgs when key_exchange_enabled is not set
authorXin Long <lucien.xin@gmail.com>
Fri, 10 Dec 2021 18:50:40 +0000 (13:50 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Dec 2021 12:31:36 +0000 (12:31 +0000)
When key_exchange is disabled, there is no reason to accept MSG_CRYPTO
msgs if it doesn't send MSG_CRYPTO msgs.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/link.c

index 09ae844..8d9e09f 100644 (file)
@@ -1298,7 +1298,8 @@ static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb,
                return false;
 #ifdef CONFIG_TIPC_CRYPTO
        case MSG_CRYPTO:
-               if (TIPC_SKB_CB(skb)->decrypted) {
+               if (sysctl_tipc_key_exchange_enabled &&
+                   TIPC_SKB_CB(skb)->decrypted) {
                        tipc_crypto_msg_rcv(l->net, skb);
                        return true;
                }