Skip to content

Commit 07428da

Browse files
tirthendu-intelAlexei Starovoitov
authored andcommitted
xsk: discard zero length descriptors in Tx path
Descriptors with zero length are not supported by many NICs. To preserve uniform behavior discard any zero length desc as invvalid desc. Signed-off-by: Tirthendu Sarkar <[email protected]> Signed-off-by: Maciej Fijalkowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent cf24f5a commit 07428da

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/xdp/xsk_queue.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ static inline bool xp_aligned_validate_desc(struct xsk_buff_pool *pool,
140140
{
141141
u64 offset = desc->addr & (pool->chunk_size - 1);
142142

143+
if (!desc->len)
144+
return false;
145+
143146
if (offset + desc->len > pool->chunk_size)
144147
return false;
145148

@@ -156,6 +159,9 @@ static inline bool xp_unaligned_validate_desc(struct xsk_buff_pool *pool,
156159
{
157160
u64 addr = xp_unaligned_add_offset_to_addr(desc->addr);
158161

162+
if (!desc->len)
163+
return false;
164+
159165
if (desc->len > pool->chunk_size)
160166
return false;
161167

0 commit comments

Comments
 (0)