mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
The current GET_TOGGLE_MEM ioctl requires the caller to supply a type enum and a raw hardware queue ID (RES_ID). The kernel looks up the CQ or SRQ by that ID without verifying that the caller owns the resource. Add a new, preferred code path that accepts standard uverbs object handles (BNXT_RE_TOGGLE_MEM_CQ_HANDLE / BNXT_RE_TOGGLE_MEM_SRQ_HANDLE) instead. The uverbs core validates that the handle belongs to the calling context as part of resolving it, so this path no longer needs the driver's own XArray lookup for ownership checking. As with the legacy path, the toggle_entry's own mmap-entry refcount (not a CQ/SRQ uobject reference) is what pins the toggle page for the life of the GET_TOGGLE_MEM handle. Only newer rdma-core versions support this path, if the driver reports the supported resp mask (BNXT_RE_UCNTX_CMASK_TOGGLE_MEM_UOBJ_SUPPORT). The existing TYPE + RES_ID path is retained for backward compatibility with older rdma-core. Suggested-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>