We don't have a single word for it and it doesn't just apply to students or sons. It's mainly done to children but I've seen adults do it to each other sarcastically.
He patted her on the head sympathetically.
She patted her son on the head, saying "Well done, you were fantastic!"