Should there be a dispute in the CDS market over a Greek reprofiling, it would be resolved by the International Swap Dealers Association (ISDA), a voluntary body which governs the market.
And while there are surely some legal loopholes to play with (which have been a big part of my assumption that things would work out), the key is that any changes, restructuring, reprofiling, etc. must be done right.