[PATCH 5.0 011/238] stm class: Fix an endless loop in channel allocation