net/nfp: fix parsing non-exist meta data
Checks
Commit Message
From: Long Wu <long.wu@corigine.com>
If the packet without meta data, the initialization logic of
'meta->flags' will be skipped and lead to the wrong logic
because of 'meta->flags' has random value.
Fix it by make sure 'meta->flags' can be initialized in any situation.
Fixes: 5eed6ad5a7b9 ("net/nfp: use flag bits to control meta data parsing")
Cc: stable@dpdk.org
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Zerun Fu <zerun.fu@corigine.com>
---
drivers/net/nfp/nfp_net_meta.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On 4/15/2024 3:47 AM, Chaoyong He wrote:
> From: Long Wu <long.wu@corigine.com>
>
> If the packet without meta data, the initialization logic of
> 'meta->flags' will be skipped and lead to the wrong logic
> because of 'meta->flags' has random value.
>
> Fix it by make sure 'meta->flags' can be initialized in any situation.
>
> Fixes: 5eed6ad5a7b9 ("net/nfp: use flag bits to control meta data parsing")
> Cc: stable@dpdk.org
>
> Signed-off-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Zerun Fu <zerun.fu@corigine.com>
>
Applied to dpdk-next-net/main, thanks.
@@ -27,7 +27,6 @@ nfp_net_meta_parse_chained(uint8_t *meta_base,
meta_info = rte_be_to_cpu_32(meta_header);
meta_offset = meta_base + 4;
- meta->flags = 0;
for (; meta_info != 0; meta_info >>= NFP_NET_META_FIELD_SIZE, meta_offset += 4) {
switch (meta_info & NFP_NET_META_FIELD_MASK) {
@@ -237,6 +236,8 @@ nfp_net_meta_parse(struct nfp_net_rx_desc *rxds,
uint8_t *meta_base;
rte_be32_t meta_header;
+ meta->flags = 0;
+
if (unlikely(NFP_DESC_META_LEN(rxds) == 0))
return;