The Messenger of Allah ﷺ said, "Do not insult the dead, for by doing so you cause harm to the living."
حدثنا محمود بن غيلان حدثنا أبو داود الحفري عن سفيان عن زياد بن علاقة قال سمعت
قال رسول الله ﷺ لا تسبوا الأموات فتؤذوا الأحياء
[Hasan]. Ahmad also narrated it, 4/252, from the hadith of Sufyan Thawri with the same wording, and Ibn Hibban graded it sahih, no. 1987. The hadith has corroborating narrations in Bukhari, no. 1393, and elsewhere.