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>
                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;
                }