Classical and thermodynamic stability of black branes