ubus: use safe iterator