Want the good news or the bad news? The good news is twofold: 1. Most head-banger babies are physically rather advanced. 2. He WILL outgrow it!
Now for the bad news: you probably have another year or two before that outgrowing thing happens *sigh*
My son did (does) this. He started right about 11 months and has tapered off over the last two months or so (he'll be two next week). Blocking him always just made it worse, since, when I tried to restrain him, I got attacked by him.
Usually, what I'd do is slide my hand between his head and the hard surface, look away from him and just wait. When he'd start to calm down, I'd then pull him into my arms, where he'd snuggle down and start to settle.
Most head-banging-in-anger is a result of the disconnect between "I can do it" and "I can't understand/say/explain" what it is I want to do." As his language skills get better, he'll stop having so many tantrums.
See if he he's not hungry, tired, frustrated, irritated, lonely or sad to set the tantrums off. My baby starts throwing fits about 30 minutes before he gets sleepy and 10 minutes after he gets hungry (or finishes eating. Whichever comes first LOL).
Patience. He doesn't know what he's doing, exactly, so punishing him may just make it worse (ask me how I know. No, don't... LOL). This'll pass. And then he'll find a new way to worry and frustrate you ;)