net/smc: free pending qentry in smc_llc_flow_stop() before memset
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 555da9af827d95134656fa459c8f3ece04dd867a · < 0879ea157acc1ac6752f6fcb755d1f91a2359238| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
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.
From the CVE record · Linux
The Linux kernel’s net/smc flow-stop function can leak a kmalloc allocation by clearing a pending queue-entry pointer without freeing it. This can happen when a duplicate CONFIRM_LINK or ADD_LINK_CONT message arrives after the original message is consumed but before the flow stops. The input does not specify whether authentication or user interaction is required.
Engineers running the Linux kernel should check whether their kernel includes the affected net/smc code; affected versions are not specified.