Linear and dynamical stability of Ricci-flat metrics