···859859860860 skb_pull(skb, sizeof(code));861861862862+ /*863863+ * The SMP context must be initialized for all other PDUs except864864+ * pairing and security requests. If we get any other PDU when865865+ * not initialized simply disconnect (done if this function866866+ * returns an error).867867+ */868868+ if (code != SMP_CMD_PAIRING_REQ && code != SMP_CMD_SECURITY_REQ &&869869+ !conn->smp_chan) {870870+ BT_ERR("Unexpected SMP command 0x%02x. Disconnecting.", code);871871+ kfree_skb(skb);872872+ return -ENOTSUPP;873873+ }874874+862875 switch (code) {863876 case SMP_CMD_PAIRING_REQ:864877 reason = smp_cmd_pairing_req(conn, skb);