The scholars have discussed whether it is permissible to dedicate the reward of actions to the deceased or if it is not permissible. And Imam Ibn Qudama a Hanbali Scholar has written about this matter and said:
Any good deed a person has done and made the intention that the reward goes to a deceased Muslim, then will benefit the deceased, if Allah wills. Regarding supplications, seeking forgiveness, charity, and completing the obligatory acts on behalf of a deceased person, then I know of no differences in opinion on this matter, and Allah SWA says (And those who came after them, they said Our Lord forgive us and our brothers who have preceded us in faith) and Allah SWA says: (and ask forgiveness for your sins and the sins of the believing men and women)
And the supplication of the Prophet ﷺ for Abu Salamah when he passed away, and the prayer for the deceased in a narration by Awf bin Malik, and for every deceased a prayer should be done for the najadeen until he is buried.
And Allah SWA has legislated the same ruling for all those who pray for the dead. A man said “Oh Messenger of Allah, My mother has died, will it benefit her if I give charity on her behalf?” the Prophet said “Yes”. The narration was reported by Abu Dawud on the authority of Sa’d bin Ubadah.
A woman came to the Prophet ﷺ and said “Oh messenger of Allah, Allah’s commandment that His servants should perform Hajj has come when my father is an old man and is unable to sit firmly on a Camel. May I perform Hajj on his behalf?” The prophet ﷺ replied “If your father had a debt would you have paid it?” she said “yes” the prophet ﷺ said “then the debt of Allah is more worthy to be paid”
The prophet ﷺ also said to the person who asked him “My mother has died without fasting a month that was due on her, Can I fast for her?” The prophet ﷺ replied “Yes”.
All of these narrations are sahih, and within them is evidence that all types of deeds benefit the deceased. Because fasting, hajj, supplication, seeking forgiveness are all physical acts of worship, the prophet ﷺ told us about their benefits upon the dead, and so that is what they did.
In a naration by Amr bin Shuaib, on the authority of his father who reported it on the authority of ‘Amr’s grandfather, that the Prophet ﷺ said to Amr bin Al Aas “Had he been a Muslim and you had emancipated slaves on his behalf, or given sadaqa on his behalf, or performed the pilgrimage on his behalf, that would have reached him.” and this is a year in which the hajj is good, as it is a act of love and obedience and so its reward has been received and he has benefitted from it, like charity and fasting the compulsory hajj.
Al Shafii said: Apart from the compulsory acts, charities, supplications, and seeking forgiveness, all other acts do not benefit the deceased and the reward doesn’t reach them, this is because of the saying of Allah SWA (And that man shall have nothing but what he strives for) and the saying of the prophet ﷺ: (If the son of Adam dies his good deeds are cut off except for three; ongoing charity, or knowledge that benefited those after him, or a dutiful child who prays for him” . Thus, the deceased cannot benefit from any deed on their behalf different from what is mentioned in the hadith.
And some said: If the Quraan is read near the deceased and the reward is intended for him, the reward only goes to the reciter. However, it is hoped that the deceased receives mercy of being present during the recitation. This view has been widely accepted by Muslims of every era without reproach . And for the reason we learn from the hadith of the prophet ﷺ “The deceased are tortured by the crying of their families” . This points to us that if Allah can allow the punishment of a sin,to be shared by the deceased, then He the All Generous is more capable to allow the reward of the good deed done in his presence to reach him.
It is permissible for people to dedicate their reward for any act of worship to the deceased, whether it be fasting, or reading the Quraan or hajj etc.