Simple way to restore your Sony Xperia phone to stock firmware,
1. for Xperia M install the Xperia P driver along with Flashboot driver.
2. you have to keep the finger on the volume down throughout the flash process
3. you can download the flashtool from http://www.flashtool.net/ go to “download” page
4. the Latest Stock Firmware C2004 / C2005 15.5.A.1.5 for C2004 is here for India Firmware Here and for C2005 is here : download and use these instead of the old files 15.5.A.0.18
For Sony Xperia M Single SIM: Follow the instructions in post http://techbeasts.com/2014/06/13/update-Sony-xperia-m-c1904c1905-to-latest-15-4-a-1-9-firmware/
For Sony Xperia M Dual SIM: Follow the instructions in post http://techbeasts.com/2014/04/01/update-Sony-xperia-m-dual-c2004c2005-to-official-android-4-3-jelly-bean-15-5-a-0-18-firmware/