Answer:
(Fatwa: 2208/1800=B/1429)
In the case mentioned above, you have to make qaza of the fasts during which you committed masturbation, but there is no kaffarah:
ولو کان مخطئاً او مکرھا فعلیہ القضاء، وکذا اذا نظر الی امراۃ فامنی لما بینا و صار کالمتفکر اذا امنی وکالمستمنی بالکف (ھدایۃ 1:217)
Allah (Subhana Wa Ta’ala) knows Best
Darul Ifta,
Darul Uloom Deoband
