It is narrated from Sayyiduna Sakhr (may Allah be pleased with him) — and he had lived in the time of the Prophet (peace and blessings be upon him) — who said that the Messenger of Allah (peace and blessings be upon him) said: "Do not revile the dead, for you will hurt the living."
Hadith Referenceالمعجم الكبير للطبراني / باب الصاد / 7247