I take it that your washer is overfilling. If this is the case, you have two possibilities:
Bad water level switch
Bad water valve
Most likely problem is a bad water valve. This is the part that the hoses connect to. Sometimes a tiny speck of sand, or rust can get into them and then they won't shut off properly. To test this theory, turn the water level setting to lowest. Put the water temperature to warm.
Fill the washer, turn the cold water off. If the water stops, then it is likely that you have a bad water valve. It the water continues, turn the hot water off. If the water continues, then it is likely that you have a bad water valve.
The answer to your question is most probably a water valve.