You may use enough force to stop the attacker. This is obviously a very open question and there is no exact answer. Use common sense. If the attacker is a 13 year old small boy - seriously hurting the child who tried to hit you may result in issues for you - both civil and criminal. If the attacker is a grown large man with a baseball bat, and obviously on drugs - you can use whatever force is necessary to stop the attack including deadly force if necessary. Once the attacker is stopped you must discontinue the force. Each situation will be entirely different and no one can guarantee you may not be charged even if acting in self defense. Good luck and be careful!