It was narrated from Sulaiman bin Amr bin Ahwas that his father said:
I heard the Messenger of Allah (ﷺ) saying during the Farewell pilgrimage: "No criminal commits a crime but he brings. (the punishment for that) upon himself. No father can bring punishment upon his son by his crime, and no son can bring punishment upon his father."
English reference: Vol. 3, Book 21, Hadith 2669
Arabic reference: Book 21, Hadith 2771