All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
It appears – Allaah Knows best – that it is permissible to name with such a name as it seems that there is no prohibition in this, and this is not tracing the daughter to other than her father; rather, it is like a compound name which is permissible as we clarified in Fatwa 97198.
Therefore, in principle, this is permissible and we are not aware of any prohibition that prevents it especially that the name of the father is written in the birth certificate as you mentioned, and what remains to be discussed is that she is attributed to her grandfather – the father of the father – and this is permissible. The Permanent Committee Fatwa reads: “It is permissible to be attributed to one’s grandfather because he is a (real) father as the Prophet said: “I am the Prophet, and I do not tell a lie; I am the son of ‘Abd Al-Muttalib!” [Al-Bukhari] It is known that Abdul Muttalib was his grandfather, the father of his father.” For more benefit, please refer to Fatwa 90364.
This is if we presume that the middle name is not the mother’s name, and in case it is the mother’s name, i.e. attributing the child to his mother [as his middle name], then attributing the new-born child to his mother is permissible as some Companions of the Prophet used to bear the name of their mother, like Mu’aath and Mu’awwith who were called the sons of ‘Afraa’, who was their mother.
Allaah Knows best.