First, did you do a full factory reset and wipe caches after flashing CM12? (failure to do so will result in a buggy rom).
If so, to return to stock you'll have to use ODIN (im sure you used that to root etc?) and use it to flash factory firmware found at sammobile.com.
Unless you can find a recovery flashable zip file of stock (you might even find a rooted version).
Or you could just flash cm11 (kitkat), very stable.
Or another lollipop based custom rom (unless you really like Samsung firmware