IDIOMS

give someone what for

(idiomatic, slang) To punish; to rebuke.

Example: 2007, Wilbur Smith, The Sound of Thunder, p. 135:
  She gave him what for all right. But you could see she was ever so pleased and she went around telling everybody about it.
2002, Joss Whedon, "The Ballad of Jayne Cobb" in "Jaynestown", Firefly.
  He robbed from the rich, and he gave to the poor / Stood up to The Man and he gave him what for.
1912, Edward Burke, Bachelor's Buttons: The Candid Confessions of a Shy Bachelor, p. 133:
  ... 'e gived 'em up, an' repented somethin' horrid — there still bein' the buns to come — but Miss Soapy she gave 'im what- for-proper, she did!