net: lan743x: Fix memleak issue when GSO enabled
[ Upstream commit2d52e2e38b] Always map the `skb` to the LS descriptor. Previously skb was mapped to EXT descriptor when the number of fragments is zero with GSO enabled. Mapping the skb to EXT descriptor prevents it from being freed, leading to a memory leak Fixes:23f0703c12("lan743x: Add main source files for new lan743x driver") Signed-off-by: Thangaraj Samynathan <thangaraj.s@microchip.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/20250429052527.10031-1-thangaraj.s@microchip.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f21fb533fc
commit
df993daa4c
@@ -1448,6 +1448,7 @@ static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx,
|
||||
if (nr_frags <= 0) {
|
||||
tx->frame_data0 |= TX_DESC_DATA0_LS_;
|
||||
tx->frame_data0 |= TX_DESC_DATA0_IOC_;
|
||||
tx->frame_last = tx->frame_first;
|
||||
}
|
||||
tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
|
||||
tx_descriptor->data0 = cpu_to_le32(tx->frame_data0);
|
||||
@@ -1517,6 +1518,7 @@ static int lan743x_tx_frame_add_fragment(struct lan743x_tx *tx,
|
||||
tx->frame_first = 0;
|
||||
tx->frame_data0 = 0;
|
||||
tx->frame_tail = 0;
|
||||
tx->frame_last = 0;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -1557,16 +1559,18 @@ static void lan743x_tx_frame_end(struct lan743x_tx *tx,
|
||||
TX_DESC_DATA0_DTYPE_DATA_) {
|
||||
tx->frame_data0 |= TX_DESC_DATA0_LS_;
|
||||
tx->frame_data0 |= TX_DESC_DATA0_IOC_;
|
||||
tx->frame_last = tx->frame_tail;
|
||||
}
|
||||
|
||||
tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
|
||||
buffer_info = &tx->buffer_info[tx->frame_tail];
|
||||
tx_descriptor = &tx->ring_cpu_ptr[tx->frame_last];
|
||||
buffer_info = &tx->buffer_info[tx->frame_last];
|
||||
buffer_info->skb = skb;
|
||||
if (time_stamp)
|
||||
buffer_info->flags |= TX_BUFFER_INFO_FLAG_TIMESTAMP_REQUESTED;
|
||||
if (ignore_sync)
|
||||
buffer_info->flags |= TX_BUFFER_INFO_FLAG_IGNORE_SYNC;
|
||||
|
||||
tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
|
||||
tx_descriptor->data0 = cpu_to_le32(tx->frame_data0);
|
||||
tx->frame_tail = lan743x_tx_next_index(tx, tx->frame_tail);
|
||||
tx->last_tail = tx->frame_tail;
|
||||
|
||||
@@ -658,6 +658,7 @@ struct lan743x_tx {
|
||||
u32 frame_first;
|
||||
u32 frame_data0;
|
||||
u32 frame_tail;
|
||||
u32 frame_last;
|
||||
|
||||
struct lan743x_tx_buffer_info *buffer_info;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user