Sahih Muslim 227
The Book of Faith
وَحَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا أَبُو مُعَاوِيَةَ، ح وَحَدَّثَنَا ابْنُ نُمَيْرٍ، - وَاللَّفْظُ لَهُ - حَدَّثَنَا أَبِي وَمُحَمَّدُ بْنُ عُبَيْدٍ، كُلُّهُمْ عَنِ الأَعْمَشِ، عَنْ أَبِي صَالِحٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " اثْنَتَانِ فِي النَّاسِ هُمَا بِهِمْ كُفْرٌ الطَّعْنُ فِي النَّسَبِ وَالنِّيَاحَةُ عَلَى الْمَيِّتِ " .
It is narrated on the authority of Abu Huraira that the Messenger of Allah (may peace and blessings be upon him) observed:Two (things) are found among men which are tantamount to unbelief: slandering one's lineage and lamentation on the dead
Text from the public-domain hadith-api dataset. Numbering follows that dataset and can differ by a few from some printed editions — check the wording, not only the number.