Nothing says true friendship than to give your buddy the only thing that can kill you.
Superman: I have many enemies who have tried to control me. And I live in fear that someday, they might succeed. If that should ever happen—if I should ever lose control—there would only be one sure way to stop me. Batman: Do you realize what you're asking? Superman: I do. I want the means to stop me in the hands of a man I can trust with my life.
In an optimistic setting, this device is from a character who is aware of their Kryptonite Factor and puts the means to stop them in the hands of another (usually, in case they're brainwashed or go evil somehow). This usually implies a bond of trust since the receiver often has mixed feelings about the idea and the giver has to insist. This is also a show of good faith to a skeptic so he will allow the hero to operate in a legal grey area.
This trope is named after the ring Superman gave Batman in case he ever got out of control.
Compare Betrayal Insurance where the "stopping" character came up with it on their own; exactly how extensive this planning comes off can seriously affect the relationship depending on how betrayed the other feels.
Professor Xavier also had the "Xavier Protocols", a set of plans on how to stop the X-Men. Xavier himself is the subject of the first entry, which includes blueprints for a telepathy-blocking battlesuit. However, these have rarely been mentioned since they were first introduced.
This specific dynamic, Batman holding Kryptonite, appears again and again, especially in the DCAU. During the height of the Cadmus story in Justice League, Batman asks Superman what could stop the latter from taking over the world, if he so desired. Supes quips, "There's always that Kryptonite you carry around." Which makes Batman snap at him for being so flippant about so serious a topic.
There's also the piece he uses against A.M.A.Z.O. when it copies Superman's powers (and weaknesses.)
Hawkgirl: Do you always keep that in your belt? Batman: Call it...insurance. (grapples away) Hawkgirl: And they call me scary.
The Batman has an incredibly cynical version. When Batman got a piece of kryptonite off of Metallo, not only did he keep it, he lied about giving it back (he gave Supes a fake one and kept the real one). He did it to "get even" with Superman for finding out his identity. However, by the end of the episode, it's the idealistic version, as they have settled their differences, and when Batman offers to give Supes the real kryptonite, Superman says to keep it. It still goes to show you that Batman really doesn't like anyone being nearly as Crazy-Prepared as him.
Why would Batman suggest that he give Superman a piece of his greatest weakness? Pretty sneaky, Batman!
The Superman/Batman comic combines the idealistic and cynical versions: after a long-term mission to destroy all the kryptonite on Earth, Superman saves one piece, which he gives to Batman for emergencies. Batman takes it to a lead-lined room in the deepest area of the Batcave... which is already filled with multiple kinds of kryptonite!
The trope is referenced, as always in combination with Crazy-Prepared, when in the first episode of Batman: The Brave and the Bold, Jaime Reyes asks his friend who he thinks would win: Batman (no kryptonite) or mind-controlled Superman. He then informs his friend, who answered "Superman", that it was a trick question: "Batman always has kryptonite".
The New 52 version is idealistic and reciprocal, as, similarly to the Professor X example above, Batman includes himself in the countermeasures list, trusting Superman to stop him if necessary.
To a lesser extent, the Shazam! Captain Marvel is employed occasionally as the one superhero tough enough to take on a controlled Superman if necessary. Or rather, he's tough enough to stall Supes in a fistfight long enough to call his magical lightning enough times to knock out his Kryptonian foenote Most forms of magic are able to bypass Superman's Nigh-Invulnerability and damage him just like a de-powered kryptonian. As for how the Kryptonite Ring trope comes into play: Superman isn't going to tell just anyone this fun little fact, but he can usually trust the goody-two-shoes Captain marvel.
Altough, at least in one occasion, it was Captain Marvel the brainwashed one, not Superman.
This is only believable when the writer depicts the lighting as strong enough to knock Supes out in one hit, or at least stagger him for a few seconds, because Billy wouldn't live long enough to say it again otherwise.
Captain Marvel can dodge the lightning after positioning himself to call it down where he wants it to hit. Which is in fact his typical strategy when he has to fight Superman.
Or, as shown in Justice League, Marvel can position Superman above him, using Supes as a (super)human shield.
From the Legion of Super-Heroes example above: General Zod's son, Drax, stole Brainiac 5's kryptonite and tries to use it on Supes, but Superman kicked him through a conveniently placed Phantom Zone portal, before he could even open the lead container.
Pre Crisis, Superman's heat vision could melt kryptonite, rendering it useless somehow. This usually worked only on small pieces, though; in one instance a large meteor of the stuff fell next to him and incapacitated him before he could melt it.
Referenced in Kingdom Come, but it's noted that Superman has grown more and more powerful as he's aged and absorbed more solar energy, and Kryptonite doesn't really work on him anymore.
Infinite Crisis subverts this when Batman tries to use his Kryptonite ring on Superman of Earth-Two, which has no effect, as explained in explication.
Kal-L: "But the Kryptonite here isn't from my Krypton. It doesn't hurt me... physically, at least. But that ring [...] represents the paranoia and mistrust that will destroy your world if you let it."
The video game Injustice: Gods Among Us takes this a step further; In Superman's ending, it's revealed that the Regime-Superman's ease at conquering the world only made him even more terrified of what could happen if he ever lost control of himself. He makes sure this doesn't happen by having a Kryptonite bomb implanted by his heart, which will instantly kill him should this happen. The other members of the Justice League all take turns carrying the detonator for it. Except for Batman, who was denied a shift.
In the Back Story of Ex Machina, The Great Machine (now the mayor of New York City) gave his two Secret Keepers devices to cancel-out his ability to talk to machines. As was his habit, he explicitly referenced the Superman mythos as he did so. As we later learn it's just junk made out of old garage door openers and doesn't affect his powers at all. He lied and gave them to his Secret Keepers so that, if they ever betrayed him or were forced to turn against him, their plotting would depend on something that doesn't work. (Though a major plot hole is that it did work in the first story arc.).
In Wolverine: Origins Wolverine gives Cyclops his magical sword, which is capable of slicing through his adamantium skeleton and negating his healing abilities, in case he gets captured and brainwashed.
Given his backstory (and more than one other story arc), that might be less "in case he gets brainwashed" and more "when he gets brainwashed. Again."
Of course his son now has it. Though at least Wolverine was able to use it to kill Sabertooth first (not that that stuck even a whole year).
There's no actual power-cancelling device, but Avatar: The Last Airbender - The Promise begins with Zuko asking Aang to kill him if he ever starts following in his father's footsteps. This comes directly after the series finale, which Aang spent trying to find a way around executing Zuko's dad (who is pretty much the most despicable man alive). And succeeded. He's not exactly thrilled, but Zuko insists he promise. Cut to a year later when Realpolitik has forced Zuko to enforce a slew of distinctive Ozai-like decisions. Cue drama.
In Star Trek: The Next Generation, there are various methods created to deal with Data to control him in case of possession or other matters. There is an off switch located on his spine that only a few know about, and some Applied Phlebotinum to disable him for extended periods.
In The Sarah Connor Chronicles, Cameron installs a bomb in her head and gives John the detonator, in case she ever becomes a threat to him.
The Kents are also known to keep pieces of green kryptonite around. It was first used to counteract red kryptonite, but later his parents and ChloeSullivan uses it a lot to stop him whenever he is mind controlled (Chloe saves Lex from Clark in Hypnotic), possessed (Jonathan saves Chloe from Dawn possessing Clark in Spirit) or is otherwise not in his right mind (Chloe saves Jonathan from Clark when he is made paranoid by silver kryptonite in Splinter).
Double Subverted in season nine. Clark gets mad at Chloe when he discovers she's been stockpiling kryptonite weapons. Then it turns out she was doing it in case he had to fight Zod and the Kandorians.
In The Dark Knight, Batman gives Lucius Fox sole control over the cell phone sonar system and the ability to destroy it so that Fox will trust him to use it only against the Joker. Though Fox didn't actually find out about the second part (cryptic instructions on how to "turn it off") until the Joker was caught.
It is eventually revealed in Final Fantasy VIII that Edea had feared being taken over by an evil sorceress, and with her husband created a fighting force to oppose her in that event, which has already come to pass by the game's beginning.
The Global Guardians keep a locked file in their comptuer database called the Code Red Omega Scenario. It is a tactical plan to take down each and every member of the Guardians, if it ever became necessary to take them all down.
Whateley Universe: As of "Ayla and the Mad Scientist" we now know Phase has at least several plans to take down every one of his teammates. And a bunch to take down himself. And his teammates know his 'official' weakness in the school records is a fake. He wrote up a list of real ways to stop himself and gave it to Lancer.