[BUG?] RDMA/siw: remote invalidate may accept an invalid STag

alu a <[email protected]> Sat, 1 Aug 2026 08:35:28 +0800
Newsgroups org.kernel.vger.linux-rdma
Message-ID <CAH+L_5asmdxZ95ctx6nj79OB83kZGzECbSKz321dr52mRwA06g@mail.gmail.com>
Hello,

Resending in plain text because the previous copy was rejected by the
mailing list.

RFC 5040 Section 7.2 requires an implementation receiving a Send with
Invalidate message to validate that the Invalidate STag is valid and
associated with the corresponding RDMAP stream.

On Linux master commit
8ba098e6b6ff0db8edf28528d1552be261af30d4, siw_rdmap_complete()
passes the peer-provided STag directly to siw_invalidate_stag():

https://github.com/torvalds/linux/blob/8ba098e6b6ff0db8edf28528d1552be261af30d4/drivers/infiniband/sw/siw/siw_qp_rx.c#L1248-L1259

siw_invalidate_stag() looks up the object using stag >> 8 and checks
its protection domain, but it does not check mem->stag_valid or compare
the complete supplied STag with mem->stag:

https://github.com/torvalds/linux/blob/8ba098e6b6ff0db8edf28528d1552be261af30d4/drivers/infiniband/sw/siw/siw_mem.c#L258-L282

Based on static source analysis, repeated invalidation of an already
invalid STag, or use of a stale key with the same index, appears to
return success rather than produce an RDMAP error.

I have not reproduced this at runtime. Is there an earlier validation
path I missed, or should incoming remote invalidation use stricter
validation than the local verbs invalidation path?

This finding came from an academic source-level RFC consistency review.

Best regards