Dynamics of magma flow inside volcanic conduits with bubble overpressure buildup and gas loss through permeable magma