diff options
| author | Mahanta Jambigi <mjambigi@linux.ibm.com> | 2026-08-18 09:39:43 +0200 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-08-20 14:12:16 -0700 |
| commit | 5ee0ceddc7785c6dcf4a8107fef01f0414a354f4 (patch) | |
| tree | dce33c0d03ee0c33e4af43884f4a6a5c84fabc41 /tools/perf/scripts/python | |
| parent | 036322025d6e440cb75fc6fecbba9a16b271a2ae (diff) | |
| download | linux-5ee0ceddc7785c6dcf4a8107fef01f0414a354f4.tar.gz linux-5ee0ceddc7785c6dcf4a8107fef01f0414a354f4.zip | |
net/smc: free pending qentry in smc_llc_flow_stop() before memset
smc_llc_flow_stop() resets a flow struct with a blind memset:
spin_lock_bh(&lgr->llc_flow_lock);
memset(flow, 0, sizeof(*flow));
flow->type = SMC_LLC_FLOW_NONE;
spin_unlock_bh(&lgr->llc_flow_lock);
If flow->qentry is non-NULL at this point the pointer is overwritten without the
allocation being freed, leaking one kmalloc object.
A late-arriving duplicate CONFIRM_LINK or ADD_LINK_CONT message can set
flow->qentry after the legitimate message has been consumed by the waiter via
smc_llc_flow_qentry_clr() (which NULLs the pointer but leaves flow->type
non-zero) but before the flow completes and smc_llc_flow_stop() runs. In that
window the duplicate is stashed into flow->qentry, and then lost when
smc_llc_flow_stop() zeros the struct.
Call smc_llc_flow_qentry_del() inside the lock before the memset.
smc_llc_flow_qentry_del() already checks flow->qentry before freeing, so the
normal case where no entry is pending is a no-op.
Fixes: 555da9af827d ("net/smc: add event-based llc_flow framework")
Reviewed-by: Hidayath Khan <hidayath@linux.ibm.com>
Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
Link: https://patch.msgid.link/20260818073943.1108383-1-mjambigi@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
