(The sad truth is that a great many locations have laws that make consenting BDSM illegal despite that consent,)
This sentence got me interested in looking up how it is in Sweden.
BDSM is perfectly legal in Sweden as long as it's within the boundaries that has been consented upon, there is a limit to it however, you cannot consent to assault in Sweden... though I find that reasonable.
If the boundaries that has been consented upon are broken that is punishable by law, seems like it's treated the same way as breaking any other agreement so it's not a special law for it.
However, practitioners doesn't get any discrimination protection (not sure if that translates correctly) nor is it considered an hate crime if they're assaulted because of the practice... but all in all I think the laws around BDSM are quite good here.