Yahya related to me from Malik from Yahya ibn Said from Abd ar- Rahman ibn Hurmuz that Abdullah ibn Buhayna said, "The Messengerof Allah ﷺ prayed dhuhr with us and he stood straight up after two rakas without sitting. When he had finished the prayer, he did two sajdas and then said the taslim after that."
Malik said, concerning someone who forgot in his prayer and stood up after he had completed four rakas and recited and then went into ruku and then, when he raised his head from ruku, remembered that he had already completed (his prayer), "He returns to a sitting position and does not do any sajda. If he has already done one sajda I do not think he should do the other. Then when his prayer is finished he does two sajdas from the sitting position after saying the taslim."
وَحَدَّثَنِي عَنْ مَالِكٍ، عَنْ يَحْيَى بْنِ سَعِيدٍ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ هُرْمُزَ، عَنْ عَبْدِ اللَّهِ ابْنِ بُحَيْنَةَ، أَنَّهُ قَالَ صَلَّى لَنَا رَسُولُ اللَّهِ ﷺ الظُّهْرَ فَقَامَ فِي اثْنَتَيْنِ وَلَمْ يَجْلِسْ فِيهِمَا فَلَمَّا قَضَى صَلاَتَهُ سَجَدَ سَجْدَتَيْنِ ثُمَّ سَلَّمَ بَعْدَ ذَلِكَ .