net: sctp: fix sctp_sf_do_5_1D_ce to verify if we/peer is AUTH capable
[firefly-linux-kernel-4.4.55.git] / net / sctp / sm_statefuns.c
index 591b44d3b7de6bb39faa994cddc72851422ec08f..ae65b6b5973a9bceca7825037317f9fc9f39e2db 100644 (file)
@@ -758,6 +758,13 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net,
                struct sctp_chunk auth;
                sctp_ierror_t ret;
 
+               /* Make sure that we and the peer are AUTH capable */
+               if (!net->sctp.auth_enable || !new_asoc->peer.auth_capable) {
+                       kfree_skb(chunk->auth_chunk);
+                       sctp_association_free(new_asoc);
+                       return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
+               }
+
                /* set-up our fake chunk so that we can process it */
                auth.skb = chunk->auth_chunk;
                auth.asoc = chunk->asoc;