DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ivan Malov <ivan.malov@arknetworks.am>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, ivan.malov@oktetlabs.ru,
	 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	 Andy Moreton <amoreton@xilinx.com>
Subject: Re: [PATCH 10/16] net/sfc: fix use-after-free warning messages
Date: Sat, 28 Sep 2024 15:52:44 +0400 (+04)	[thread overview]
Message-ID: <93601a51-7c39-d0d1-906c-7475b6560730@arknetworks.am> (raw)
In-Reply-To: <20240927204742.546164-11-stephen@networkplumber.org>

Reviewed-by: Ivan Malov <ivan.malov@arknetworks.am>

Thank you.

On Fri, 27 Sep 2024, Stephen Hemminger wrote:

> If compiler detection of use-after-free is enabled then this drivers
> debug messages will cause warnings. Change to move debug message
> before the object is freed.
>
> Bugzilla ID: 1551
> Fixes: 55c1238246d5 ("net/sfc: add more debug messages to transfer flows")
> Cc: ivan.malov@oktetlabs.ru
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> drivers/net/sfc/sfc_flow_rss.c |  4 ++--
> drivers/net/sfc/sfc_mae.c      | 23 +++++++++--------------
> 2 files changed, 11 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/sfc/sfc_flow_rss.c b/drivers/net/sfc/sfc_flow_rss.c
> index e28c943335..8e2749833b 100644
> --- a/drivers/net/sfc/sfc_flow_rss.c
> +++ b/drivers/net/sfc/sfc_flow_rss.c
> @@ -303,9 +303,9 @@ sfc_flow_rss_ctx_del(struct sfc_adapter *sa, struct sfc_flow_rss_ctx *ctx)
>
> 	TAILQ_REMOVE(&flow_rss->ctx_list, ctx, entries);
> 	rte_free(ctx->qid_offsets);
> -	rte_free(ctx);
> -
> 	sfc_dbg(sa, "flow-rss: deleted ctx=%p", ctx);
> +
> +	rte_free(ctx);
> }
>
> static int
> diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
> index 60ff6d2181..8f74f10390 100644
> --- a/drivers/net/sfc/sfc_mae.c
> +++ b/drivers/net/sfc/sfc_mae.c
> @@ -400,9 +400,8 @@ sfc_mae_outer_rule_del(struct sfc_adapter *sa,
> 	efx_mae_match_spec_fini(sa->nic, rule->match_spec);
>
> 	TAILQ_REMOVE(&mae->outer_rules, rule, entries);
> -	rte_free(rule);
> -
> 	sfc_dbg(sa, "deleted outer_rule=%p", rule);
> +	rte_free(rule);
> }
>
> static int
> @@ -585,9 +584,8 @@ sfc_mae_mac_addr_del(struct sfc_adapter *sa, struct sfc_mae_mac_addr *mac_addr)
> 	}
>
> 	TAILQ_REMOVE(&mae->mac_addrs, mac_addr, entries);
> -	rte_free(mac_addr);
> -
> 	sfc_dbg(sa, "deleted mac_addr=%p", mac_addr);
> +	rte_free(mac_addr);
> }
>
> enum sfc_mae_mac_addr_type {
> @@ -785,10 +783,10 @@ sfc_mae_encap_header_del(struct sfc_adapter *sa,
> 	}
>
> 	TAILQ_REMOVE(&mae->encap_headers, encap_header, entries);
> +	sfc_dbg(sa, "deleted encap_header=%p", encap_header);
> +
> 	rte_free(encap_header->buf);
> 	rte_free(encap_header);
> -
> -	sfc_dbg(sa, "deleted encap_header=%p", encap_header);
> }
>
> static int
> @@ -983,9 +981,8 @@ sfc_mae_counter_del(struct sfc_adapter *sa, struct sfc_mae_counter *counter)
> 	}
>
> 	TAILQ_REMOVE(&mae->counters, counter, entries);
> -	rte_free(counter);
> -
> 	sfc_dbg(sa, "deleted counter=%p", counter);
> +	rte_free(counter);
> }
>
> static int
> @@ -1165,9 +1162,8 @@ sfc_mae_action_set_del(struct sfc_adapter *sa,
> 	sfc_mae_mac_addr_del(sa, action_set->src_mac_addr);
> 	sfc_mae_counter_del(sa, action_set->counter);
> 	TAILQ_REMOVE(&mae->action_sets, action_set, entries);
> -	rte_free(action_set);
> -
> 	sfc_dbg(sa, "deleted action_set=%p", action_set);
> +	rte_free(action_set);
> }
>
> static int
> @@ -1401,10 +1397,10 @@ sfc_mae_action_set_list_del(struct sfc_adapter *sa,
> 		sfc_mae_action_set_del(sa, action_set_list->action_sets[i]);
>
> 	TAILQ_REMOVE(&mae->action_set_lists, action_set_list, entries);
> +	sfc_dbg(sa, "deleted action_set_list=%p", action_set_list);
> +
> 	rte_free(action_set_list->action_sets);
> 	rte_free(action_set_list);
> -
> -	sfc_dbg(sa, "deleted action_set_list=%p", action_set_list);
> }
>
> static int
> @@ -1667,9 +1663,8 @@ sfc_mae_action_rule_del(struct sfc_adapter *sa,
> 	sfc_mae_outer_rule_del(sa, rule->outer_rule);
>
> 	TAILQ_REMOVE(&mae->action_rules, rule, entries);
> -	rte_free(rule);
> -
> 	sfc_dbg(sa, "deleted action_rule=%p", rule);
> +	rte_free(rule);
> }
>
> static int
> -- 
> 2.45.2
>
>

  reply	other threads:[~2024-09-28 11:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-27 20:45 [PATCH 00/16] Fix allocation issues and add hardening Stephen Hemminger
2024-09-27 20:45 ` [PATCH 01/16] eal: add function attributes for allocation functions Stephen Hemminger
2024-09-27 22:09   ` David Marchand
2024-09-27 23:10     ` Stephen Hemminger
2024-09-27 20:45 ` [PATCH 02/16] memzone: fix use after free in tracing Stephen Hemminger
2024-09-27 20:45 ` [PATCH 03/16] cryptodev/bcmfs: fix mis-matched free Stephen Hemminger
2024-09-27 20:45 ` [PATCH 04/16] dma/ixd: fix incorrect free function in cleanup Stephen Hemminger
2024-09-27 20:45 ` [PATCH 05/16] event/cnxk: fix pointer mismatch " Stephen Hemminger
2024-09-27 20:45 ` [PATCH 06/16] examples/vhost: fix free function mismatch Stephen Hemminger
2024-09-27 20:45 ` [PATCH 07/16] net/cnxk: fix use-after-free Stephen Hemminger
2024-09-27 20:45 ` [PATCH 08/16] bpf: fix free mismatch if convert fails Stephen Hemminger
2024-09-27 20:45 ` [PATCH 09/16] net/e1000: fix use-after-free Stephen Hemminger
2024-09-27 20:45 ` [PATCH 10/16] net/sfc: fix use-after-free warning messages Stephen Hemminger
2024-09-28 11:52   ` Ivan Malov [this message]
2024-09-27 20:45 ` [PATCH 11/16] net/cpfl: fix free of nonheap object Stephen Hemminger
2024-09-27 20:45 ` [PATCH 12/16] raw/ifpga/base: fix use after free Stephen Hemminger
2024-09-27 20:45 ` [PATCH 13/16] common/qat: " Stephen Hemminger
2024-09-27 20:45 ` [PATCH 14/16] drivers/ifpga: fix free function mismatch Stephen Hemminger
2024-09-27 20:45 ` [PATCH 15/16] eal: add alloc_function attribute to rte_malloc Stephen Hemminger
2024-09-27 20:45 ` [PATCH 16/16] mempool: annotate mempool create Stephen Hemminger
2024-09-28 11:49   ` Morten Brørup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93601a51-7c39-d0d1-906c-7475b6560730@arknetworks.am \
    --to=ivan.malov@arknetworks.am \
    --cc=amoreton@xilinx.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ivan.malov@oktetlabs.ru \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).