I used to have that problem, because I was holding the pistol wrong (too loosely) and limp-wristing it a bit.
At about the same time I changed the way I held the pistol, and I put on a Hogue Hand-All slip on. After that I haven't had an upward ejection, so it could have been either change that fixed it.
Jeremy