How do I get my Sony Xperia M out of a boot loop?

Re: my sony xperia m is stuck on boot loop

You Cannot boot the phone correct? Complete till the second step.. and then remove your battery and put it back in 10-15 seconds....then hold volume down button(only that) and insert your usb cable it will say as device connected in flashmode... then follow from step 4 and leave step 6..... just select the firmware and it might be named as C190X and at right bottom click the button flash... you're done... congrats your phone will boot in 10-15 mins or less.....
thank you,
Rahul (Sony Official)
Sent By- Sony Xperia Z2.

Hi thanks man you saved me. Now I have learnt about custom ROM and how to flash them
 
Hi RahulArvind,

My phone got stuck in boot loop after I tried unlocking the bootloader as per the instructions given on Sony portal.
I tried to reset the phone you suggested. It worked,but I am facing another problem now.
My phone has been reset to the initial version 4.1.2 and when I am trying to update the version using PC companion
it is showing the latest build version (15.4.A.1.9) available. My phone is showing the build version (15.4.A.1.9).
Also Bootloader Unlocked value is showing as NO, which was showing previously as Yes on Android version 4.3.

Please help.

Thanks