I hope to find time to elaborate this answer later:
There are basically two different sahabah on whom's authority this was transmitted:
- ibn 'Abbas () as a marfo' hadith
- abu Hurairah () -which also shoule be regarded as marfo'-
- it is also mentioned that 'Aishah (), ibn 'Umar (), abu Dharr, Sahl ibn Sa'ad and others have reported something similar.
At least the second version (needs to be verified) has been declared as da'if by scholars such as ibn al-Jawzy and al-Albani.
Ibn 'Abd al-Barr quoted the first in his book al-Istidhkar with a full chain:
أخْبَرَنَا أَبُو عَبْدِ اللَّهِ عُبَيْدُ بْنُ مُحَمَّدٍ قِرَاءَةً مِنِّي عَلَيْهِ سَنَةَ تِسْعِينَ وَثَلَاثِمِائَة ٍ فِي رَبِيعٍ الْأَوَّلِ قَالَ أَمْلَتْ عَلَيْنَا فَاطِمَةُ بِنْتُ الرَّيَّانِ الْمُسْتَمْلِيّ ِ فِي دَارِهَا بِمِصْرَ في شوال سنة اثنتين وأربعين وثلاث مئة قَالَتْ حَدَّثَنَا الرَّبِيعُ بْنُ سُلَيْمَانَ الْمُؤَذِّنُ صَاحِبُ الشَّافِعِيِّ قَالَ حَدَّثَنَا بِشْرُ بْنُ بُكَيْرٍ عَنِ الْأَوْزَاعِيِّ عَنْ عَطَاءٍ عَنْ عُبَيْدِ بْنِ عُمَيْرٍ عَنْ ابن عَبَّاسٍ قَالَ : قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ _ : " مَا مِنْ أَحَدٍ مَرَّ بِقَبْرِ أَخِيهِ الْمُؤْمِنِ كَانَ يَعْرِفُهُ فِي الدُّنْيَا فَسَلَّمَ عَلَيْهِ إِلَّا عَرَفَهُ وَرَدَّ عَلَيْهِ السَّلَامَ "
وهذا إسنادٌ فيه : فاطمة بنت الريان المستملي هذه ؛ لم أقف لها على ترجمةٍ عند أهل العلم . فهي تعد : مجهولة الحال . والله أعلم _ .
Ibn Tayymiyah, ibn Qayyim and ibn Kathir quoted this version with an addition, but referring to ibn 'abd al-Barr's statement that it is sahih:
وما من رجُلٍ يمرُّ بقبرِ الرَّجلِ كانَ يعرفُهُ في الدُّنيا فيسلِّمُ عليْهِ إلَّا ردَّ اللَّهُ عليْهِ روحَهُ حتَّى يردَّ عليْهِ السَّلامَ
None of you passes by the grave of a fellow believer that he knew in this life and sends salutations to him except that Allah returns him his soul so that he can respond to his salutation.
There are two issues with the version from ibn 'Abd al-Barr that at least al-Albani quoted:
- the first is ibn 'Abd al-Barr's teacher who seemed unknown to al-Albani, but he is known as 'Ubayd ibn Muhammad al-Qaysi al-Qurtubi who was called Abu 'Abdillah and known as ibn Hameed عُبَيْد بن مُحمَّد بن أحْمَد بن مُحمد بن أحمد القَيْسِ (the author ibn al-Fardy ابن الفرضى -who met him and lsited him in his book about Scholars of al-Andalus- or editor must have made a mistake saying he was born 210 a.H. after quoting his death at 392 a.H.) and was around 80 years old when dictating that hadith (he died two years later) and somehow preserved this hadith about 50 years before sharing it as none except with ibn 'Abd al-Barr apparently heard it from him and he was frequently narrating hadith.
- the second is Fatimah bint ar-Rayyan فاطمة بنت الريان of which ibn 'Abd al-Barr himself didn't know anything -it is also strange that as an Egyptian lady only a scholar from Qurtubah (Cordoba) has heard this hadith from her-, but a-Dhahabi could at least identify her as the teacher of ibn an-Nuhass ابن النحاس- wikipedia there quotes from Siyar 'alam an-Nubalaa'- and whom dictated this to his teacher abu 'Abdulah 'Ubayd ibn Muhammad.
The rest of the narrators in this chain rather has a high level of trustworthiness -if the hadith is authentic-:
Ibn 'Abd al-Barr -dictation Rabi' 1st 390 a.H.-> 'Abdullah ibn 'Ubayd ibn Muhammad -dictation in her home Egypt Shawwal 342 a.H.-> Fatimah bint ar-Rayyan
-> ar-Rabi' ibn Sulayman the student of a Shafi'i -> Bishr ibn Bukayr -> imam al-Awza'iy ->
'Ataa' -> 'Ubayd ibn 'Umayr -> ibn 'Abbas.
Note that I nowhere found a statement of ibn 'Abd al-Barr claiming this hadith to be sahih, this rather seems the claim of 'Abdulhaqq al-Ishbeely! Therefore I don't know where ibn Tayymyah and others get this information from. And further al-'Iraqi wrote in his footnote on al-Ihya' that ibn 'Abd al-Barr quoted the hadith in al-Istidhkar and at-Tamheed which is wrong as it apparently can't be found in this second sources. 'Abdulhaqq al-Ishabeely certainly quoted the hadith in 3 of his books and always referred to ibn 'Abd al-Barr's book al-Istidhkar (only) as a source.
Another issue is that more known and trustworthy narrators from ar-Rabi' ibn Sulayman narrated this via a totally different chain here two examples:
- Abu al-'Abbas Muhammad ibn Ya'aqub al-Assam أبو العباس محمد بن يعقوب الأصم (trustworthy; narrated many ahadith from ar-Rabi'i -> ar-Rabi'i ibn Sulayman الربيع بن سليمان المرادي (trustworthy) -> 'Abudrrahman ibn Zayd ibn Aslam عبد الرحمن بن زيد بن أسلم -> His father Zayd ibn Aslam -> 'Ata' ibn Yassar عطاء بن يسار -> Abu Hurrairah
- Muhammad ibn Makhlad ar-Ra'eeny al-Himsi محمد بن مخلد الرعيني الحمصي (matrook, munkar al-Hadith) -> Bishr ibn Bakr at-Tanisi بشر بن بكر التنيسي (trustworthy) -> ar-Rabi'i ibn Sulayman -> 'Abudrrahman ibn Zayd ibn Aslam عبد -> His father Zayd ibn Aslam -> 'Ata' ibn Yassar -> Abu Hurrairah
This version was rejected by ibn Hebban, a-Dhahabi and ibn al-Jawzy due to 'Aburrahman ibn Zayd ibn Aslam as he used to change narrations unknowingly (maybe a bad memory in his late years)
This hadith was also not mentioned in any of the six books even if the chain:
-> 'Abdurrahman ibn Zayd -> Zayd ibn Aslam -> 'Ata' -> abu Hurrairah
is a chain that appears in both sahihs. So they had certainly reasons for rejecting it.
Other scholars who declared it as da'if are:
Ibn Hebban (in al-Majrooheen and he is often regarded as lenient, but not in this book, see also Is there a scale or classification for scholars and their qualification of hadith narrators?), ibn al-Qaysarani, ibn Rajab al-Hanbali (who confirmed the trustworthiness of the narrators, but qualified it as strange even munkar) and a-Dhahabi.
Among those who declared it as sahih are ibn Tayymiyah, a-Shawkani, al-'Ayni (in his 'Umdat al-Qari), Al-Qurtubi (the hadith commentator on Sahih Muslim not the mufassir: in his al-Mufham) and 'Abdulhaqq al-Ishbeely. Note that none of these are the first that come to mind when one thinks about 'Ilm al-Jarh wa a-Ta'adeel, while among the list above there are some scholars with a reputation in this science.
Some sources -in Arabic-: