good advice, my son is also the same. i have seen him "masturbating" in his room, open door, in the bath, when he gets out of the bath, he is still erect & walks to his room..
The fact that you say you "caught" him - sounds to me like he thought he had privacy and you walked in unexpectedly.
He needs to have places that are private and no one comes in unexpectedly - the bathroom, his bedroom, etc.
Many children will become aware of their bodies after a few years, then they will explore them!! Its perfectly normal..i suggest trying to encourage him to do this in private! Thats certainly not something they should be doing in front of ppl. But its fine, dnt worry! My son is the same..
This is a normal behavior in a child. I would not be concerned but it might be a good time to let him know this is a private matter and not something for others to see. Let him know this is not acceptable except in private.