Treiber stack push via compare_exchange_weak

Is this Treiber-stack push implementation correct? In particular, note that n->next is assigned once before the loop and is never manually reloaded inside the loop body.

main.cpp
struct Node { int value; Node* next; };
std::atomic<Node*> head{nullptr};

void push(Node* n) {
    n->next = head.load(std::memory_order_relaxed);
    while (!head.compare_exchange_weak(
               n->next, n,
               std::memory_order_release,
               std::memory_order_relaxed)) {
        // retry
    }
}

10 of 51 in Concurrency