M.M.
Oh that is such a scary thing. I can remember my cousin doing it as a child. I am six months older than him and he did until he was 5 or 6. My aunt and uncle were told to just leave him alone and leave the room and he will eventually stop which didn't really help. Which is why I feel he did it for so long. He would even do it on concrete. It was very scary to watch as a child. It is best to grab a pillow or somethign soft to cushion his head and then once he is done talk to him about what he did and perhaps other ways to release his anger and frustration. Then he feels you usnderstand the emotions he is feeling but there are other ways to release it. I have found with my son who is now three, that the more I talk to him about his emotions the better he responds to his frustrations. My son likes to hit and kick when he is angry. He can be very aggressive. I have also found that if I give him a choice when he can't have something he wants it helps distract him. Then he feels like he is getting to make his own decisions. It works great when he wants junk food. So if you have to say no to something, say no and then say would you like to play with this or that? Then he feels better about the situation b/c he feels he has control. Here is a link you might find useful.
http://www.becomingtheparent.com/subsections1/question18....
I hope he will grow out of it quickly. Good luck