Magnetic quantum ring in two-dimensional topological insulators