[PATCH 4.14 005/183] stm class: Fix an endless loop in channel allocation