diff options
| author | Xuanqiang Luo <luoxuanqiang@kylinos.cn> | 2026-07-10 17:05:22 +0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-07-21 11:18:32 -0700 |
| commit | be9381d5776c9b790d0b3429846c46bca3b8634a (patch) | |
| tree | f242a1163661bccbf247c22582b6ebc26364a84a /tools/perf/scripts/python | |
| parent | ede0f99cef53ae142ec9f54c705e4b1e48355fd3 (diff) | |
bna: fix use-after-free on DMA mapping failure
If dma_map_single() fails in bnad_start_xmit(), the skb is freed, but
head_unmap->skb was set before the mapping attempt and is not cleared. The
producer index is not advanced, so later transmissions normally overwrite
the entry.
However, if the interface is brought down first, bnad_txq_cleanup() scans
the entire unmap queue, finds the stale pointer, and calls
bnad_tx_buff_unmap() on it. That function dereferences the freed skb in
skb_headlen(). Its zero nvecs count is decremented to -1, causing its
while (nvecs) loop to repeatedly unmap entries around the TX ring and
potentially hang cleanup.
Set head_unmap->skb after the first DMA mapping succeeds. This prevents the
stale entry from reaching bnad_tx_buff_unmap().
Cc: stable+noautosel@kernel.org # untested fix to unlikely error path
Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260710090527.58354-2-xuanqiang.luo@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
