diff options
| author | Jiangshan Yi <yijiangshan@kylinos.cn> | 2026-07-28 21:14:41 +0800 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2026-08-03 19:20:55 +0200 |
| commit | db2333f88729c8aae062cb171ed058725ff5c901 (patch) | |
| tree | 90b925c29883e6d60f066fe20c833ca0198fb28c /tools/perf/scripts/python/stackcollapse.py | |
| parent | dca151633c0fde90935311c60e7cfc064aa56134 (diff) | |
HID: mcp2221: clear rxbuf after I2C/SMBus transfer completes
mcp_i2c_smbus_read() stores the caller-supplied buffer pointer in
mcp->rxbuf for the duration of a transfer but never clears it when the
transfer finishes or times out. Once the caller frees or reuses the
buffer, mcp->rxbuf becomes a dangling pointer. A delayed or spurious
MCP2221_I2C_GET_DATA report can then drive mcp2221_raw_event() to
memcpy device data into the freed memory, causing a write
use-after-free.
Route all return paths through a single exit point that clears
mcp->rxbuf and mcp->rxbuf_size, so that the existing !mcp->rxbuf guard
in the raw_event handler can reject any report arriving after the
transfer has ended.
Fixes: 67a95c21463d ("HID: mcp2221: add usb to i2c-smbus host bridge")
Cc: stable@vger.kernel.org
Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
