Protect circuit from current generated by backdriving DC motor
Basically you need a diode in series with the supply to the motor -- that will prevent the motor from supplying power back to the supply.

Trouble is the diode will drop 0.7 V and will dissipate power -- you can use a MOSFET in the supply or GND connection and drive it on when the motor is on, and off when the motor is off. You'll have to connect that FET with drain &amp; source backwards from normal usage.