Like
@Scubagolf, I've only had a freeflow happen on the surface when the reg was out of my mouth so I just flipped it over & it stopped. I haven't really seen this mentioned often as happening underwater unless you're diving super cold/ice, but if it does happen here'd be my plan of action:
1. Tap the reg to see if it stops freeflowing. (Even if it does, I would still ascend with my buddy & wouldn't dive with that reg until it was serviced by a professional shop.) If it doesn't stop, then I'd...
2. Try to kink it like a garden hose to reduce/stop the flow & then use my other reg while ascending with my buddy.
3. If #2 doesn't work, I would likely "sip" air from the freeflowing reg as taught during open water certification & ascend with my buddy.
4. If I run out of air, I would use my buddy's spare while we ascend.
Most of all, I'd tried to stay calm as this is a survivable scenario whereas panic can kill you.
btw
@gr8jab I think people new to diving can focus on random things because everything is so unfamiliar & they don't know which scenarios are more likely to occur. When I was a newbie, \ I focused on whether I would be constantly (& alarmingly) holding my breath all the time since I was trained as a synchronized swimmer to hold my breath underwater. I didn't have this problem as a diver & in fact have the opposite problem...I now breathe underwater even when I shouldn't like when I'm snorkeling. lol