Your son is a bit young to be masturbating to any significant degree, though of course there are no 'rules' about this in any strict sense. In a general way, I'd let him know that the behavior should occur only in private settings, when he is alone. Now, with some young children masturbation at a young age occurs due to anxiety, social isolation, etc., and if you suspect that he may be in any distress an evaluation by a
mentalMental retardation
Mental status tests health professional would be sensible. The clinician might also be a useful
resourceResource optisource to you and to your son's mother.