Commit 07428da9 authored by Tirthendu Sarkar's avatar Tirthendu Sarkar Committed by Alexei Starovoitov

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: default avatarTirthendu Sarkar <tirthendu.sarkar@intel.com>
Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/r/20230719132421.584801-10-maciej.fijalkowski@intel.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent cf24f5a5
...@@ -140,6 +140,9 @@ static inline bool xp_aligned_validate_desc(struct xsk_buff_pool *pool, ...@@ -140,6 +140,9 @@ static inline bool xp_aligned_validate_desc(struct xsk_buff_pool *pool,
{ {
u64 offset = desc->addr & (pool->chunk_size - 1); u64 offset = desc->addr & (pool->chunk_size - 1);
if (!desc->len)
return false;
if (offset + desc->len > pool->chunk_size) if (offset + desc->len > pool->chunk_size)
return false; return false;
...@@ -156,6 +159,9 @@ static inline bool xp_unaligned_validate_desc(struct xsk_buff_pool *pool, ...@@ -156,6 +159,9 @@ static inline bool xp_unaligned_validate_desc(struct xsk_buff_pool *pool,
{ {
u64 addr = xp_unaligned_add_offset_to_addr(desc->addr); u64 addr = xp_unaligned_add_offset_to_addr(desc->addr);
if (!desc->len)
return false;
if (desc->len > pool->chunk_size) if (desc->len > pool->chunk_size)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment