حَدَّثَنَا إِسْحَاقُ، عَنْ عَبْدِ الرَّزَّاقِ، عَنِ الثَّوْرِيِّ، عَنْ خُصَيْفٍ، عَنْ أَبِي عُبَيْدَةَ، عَنِ ابْنِ مَسْعُودٍ، قَالَ: «السَّهْوُ إِذَا قَامَ فِيمَا يُجْلَسُ فِيهِ، أَوْ قَعَدَ فِيمَا يُقَامُ فِيهِ، أَوْ سَلَّمَ فِي رَكْعَتَيْنِ فَإِنَّهُ يَفْرُغُ مِنْ صَلَاتِهِ، وَيَسْجُدُ سَجْدَتَيْنِ، وَهُوَ جَالِسٌ يَتَشَهَّدُ فِيهِمَا»
Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) said: "Forgetfulness is when a person stands up where he should have sat, or sits where he should have stood, or gives the salam after two rak'ahs. In such a case he should complete his prayer, perform two prostrations while sitting, and recite the tashahhud in them."