Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Mika Westerberg
Mon, 30 Nov 2026 11:36
[PATCH v3 0/4] net: thunderbolt: Various fixes
Author: Mika Westerberg
Date: Mon, 30 Nov 2026 11:36
Date: Mon, 30 Nov 2026 11:36
36 lines
10345 bytes
10345 bytes
Hi all,
This series fixes various issues. Tree of them was pointed out by Sashiko
during code review, one was found during development of those fixes.
The previous versions of the series can be found:
v2: https://lore.kernel.org/netdev/20261116142613.876208-1-mika.westerberg@linux.intel.com/
v1: https://lore.kernel.org/netdev/20261103125621.1111198-1-mika.westerberg@linux.intel.com/
Changes from v2:
- Release partially completed skb also on the error path.
- New patch fixing race condition between tbnet_tear_down() and
tbnet_connected_work().
Changes from v1:
- Prevent unintended refilling the Rx ring if poll triggers during
tear down.
- Keep polling if we fail to allocate new Rx descriptors to avoid
permanent stop.
- New patch that releases partially completed skb.
Mika Westerberg (Intel) (4):
net: thunderbolt: Fix race condition when the link is torn down
net: thunderbolt: Stop queueing Rx buffers if allocation fails
net: thunderbolt: Prevent Tx descriptor leak in tbnet_start_xmit()
net: thunderbolt: Free partially completed skb when the link is torn down
drivers/net/thunderbolt/main.c | 108 ++++++++++++++++++++++++---------
1 file changed, 79 insertions(+), 29 deletions(-)
--
2.50.1
[PATCH v3 3/4] net: thunderbolt: Prevent Tx descriptor leak in tbnet_start_xmit()
Author: Mika Westerberg
Date: Mon, 30 Nov 2026 11:36
Date: Mon, 30 Nov 2026 11:36
78 lines
12030 bytes
12030 bytes
From: "Mika Westerberg (Intel)" <westeri@kernel.org>
Sashiko pointed out that tbnet_start_xmit() may leak one Tx
descriptor on three error paths jumping to err_drop because frame_index
is not yet updated but the Tx descriptor is already used. This will
accumulate over time and in the worst case run out of Tx descriptors
completely.
Fix this by subtracting the correct number on error path.
Fixes: e69b6c02b4c3 ("net: Add support for networking over Thunderbolt cable")
Closes: https://sashiko.dev/#/patchset/20260902082128.1148463-1-mika.westerberg%40linux.intel.com
Cc: stable@vger.kernel.org
Signed-off-by: Mika Westerberg (Intel) <westeri@kernel.org>
---
drivers/net/thunderbolt/main.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/thunderbolt/main.c b/drivers/net/thunderbolt/main.c
index d5e49bc38104..0bf4c8137f21 100644
--- a/drivers/net/thunderbolt/main.c
+++ b/drivers/net/thunderbolt/main.c
@@ -1173,13 +1173,13 @@ static netdev_tx_t tbnet_start_xmit(struct sk_buff *skb,
struct tbnet_frame *frames[MAX_SKB_FRAGS];
u16 frame_id = atomic_read(&net->frame_id);
struct thunderbolt_ip_frame_header *hdr;
+ bool unmap = false, index_used = false;
unsigned int len = skb_headlen(skb);
unsigned int data_len = skb->len;
unsigned int nframes, i;
unsigned int frag = 0;
void *src = skb->data;
u32 frame_index = 0;
- bool unmap = false;
void *dest;
trace_tbnet_tx_skb(skb);
@@ -1233,6 +1233,7 @@ static netdev_tx_t tbnet_start_xmit(struct sk_buff *skb,
src = tbnet_kmap_frag(skb, frag++, &len);
unmap = true;
} else if (unlikely(size_left > 0)) {
+ index_used = true;
goto err_drop;
}
} while (size_left > 0);
@@ -1269,6 +1270,7 @@ static netdev_tx_t tbnet_start_xmit(struct sk_buff *skb,
src = tbnet_kmap_frag(skb, frag++, &len);
unmap = true;
} else if (unlikely(data_len > 0)) {
+ index_used = true;
goto err_drop;
}
}
@@ -1278,8 +1280,10 @@ static netdev_tx_t tbnet_start_xmit(struct sk_buff *skb,
if (unmap)
kunmap_local(src);
- if (!tbnet_xmit_csum_and_map(net, skb, frames, frame_index + 1))
+ if (!tbnet_xmit_csum_and_map(net, skb, frames, frame_index + 1)) {
+ index_used = true;
goto err_drop;
+ }
for (i = 0; i < frame_index + 1; i++)
tb_ring_tx_more(net->tx_ring.ring, &frames[i]->frame);
@@ -1299,6 +1303,9 @@ static netdev_tx_t tbnet_start_xmit(struct sk_buff *skb,
err_drop:
/* We can re-use the buffers */
net->tx_ring.cons -= frame_index;
+ /* Return back the current slot as well */
+ if (index_used)
+ net->tx_ring.cons--;
dev_kfree_skb_any(skb);
net->stats.tx_errors++;
--
2.50.1
Re: [PATCH v3 0/4] net: thunderbolt: Various fixes
Author: netdev-bot+sinfo
Date: Mon, 30 Nov 2026 11:39
Date: Mon, 30 Nov 2026 11:39
19 lines
8571 bytes
8571 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - Whether the issue was actually triggered, or is only theoretical (e.g. found by LLM and not proven at runtime). If it was triggered please include the symptoms, like the stack trace or kernel messages. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. *IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages. -- The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads