صحيح البخاري Sahih Bukhari كتاب السهو The Book of As-Sahw (Forgetting)
بَابُ السَّهْوِ فِي الْفَرْضِ وَالتَّطَوُّعِ:

(7) Chapter. Sahw (forgetfulness) in compulsory Salat (prayer) and Nawafil.

1 hadith
Hadith 1232
حَدَّثَنَا عَبْدُ اللَّهِ بْنُ يُوسُفَ ، أَخْبَرَنَا مَالِكٌ ، عَنِ ابْنِ شِهَابٍ ، عَنْ أَبِي سَلَمَةَ بْنِ عَبْدِ الرَّحْمَنِ ، عَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ ، أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ , قَالَ : " إِنَّ أَحَدَكُمْ إِذَا قَامَ يُصَلِّي جَاءَ الشَّيْطَانُ فَلَبَسَ عَلَيْهِ حَتَّى لَا يَدْرِيَ كَمْ صَلَّى ، فَإِذَا وَجَدَ ذَلِكَ أَحَدُكُمْ فَلْيَسْجُدْ سَجْدَتَيْنِ وَهُوَ جَالِسٌ " .
Narrated Abu Huraira: Allah's Apostle said, "When anyone of you stands for the prayers, Satan comes and puts him in doubts till he forgets how many rak`at he has prayed. So if this happens to anyone of you, he should perform two prostrations of Sahu while sitting.
Hadith Reference Sahih Bukhari / The Book of As-Sahw (Forgetting) / Hadith: 1232
Hadith Grading محدثین: أحاديث صحيح البخاريّ كلّها صحيحة