summaryrefslogtreecommitdiff
path: root/include/linux/stackprotector.h
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2026-06-02 22:37:28 +0300
committerJason Gunthorpe <jgg@nvidia.com>2026-06-05 19:07:45 +0300
commit9b2207bc5cdb955bdae34b3eec80f04979e17081 (patch)
tree0a86a8ae841e55a80c7365582c2616c59888010e /include/linux/stackprotector.h
parent6219a17c3741461cee83cf82252b15c7f99a9f2a (diff)
downloadlinux-9b2207bc5cdb955bdae34b3eec80f04979e17081.tar.xz
IB/cm: Fix av cm device leak on an error path in cm_init_av_by_path()
Codex pointed out that cm_init_av_by_path() can call cm_set_av_port() which takes a reference on the cm device, but then can immediately return error if ib_init_ah_attr_from_path() fails. Since callers like ib_send_cm_req() put the av on the stack this leaks that cm device reference. Re-order cm_init_av_by_path() so it doesn't touch the av until it has done all its failable work, and then update the av in one shot so it is either left alone or fully init'd. Sashiko also pointed out that the cm_destroy_av() prior to cm_init_av_by_path() is harmful as it leaves the AV broken in the error case and thus the REJ won't send. Since cm_init_av_by_path() is now atomic it is safe to delete the cm_destroy_av(). On succees the av from cm_init_av_for_response() is cleaned up by cm_init_av_by_path(), on failure the 'goto rejected' guarentees the av is destroyed during ib_destroy_cm_id(). Fixes: 76039ac9095f ("IB/cm: Protect cm_dev, cm_ports and mad_agent with kref and lock") Link: https://patch.msgid.link/r/0-v1-38292501f539+14f-ib_cm_av_leak_jgg@nvidia.com Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'include/linux/stackprotector.h')
0 files changed, 0 insertions, 0 deletions