From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E882D45AE3; Tue, 8 Oct 2024 18:50:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D28440E32; Tue, 8 Oct 2024 18:49:10 +0200 (CEST) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 76F0540DDE for ; Tue, 8 Oct 2024 18:49:01 +0200 (CEST) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-20b64584fd4so56527235ad.1 for ; Tue, 08 Oct 2024 09:49:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728406141; x=1729010941; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NIKMlyZ2ZqwKuu4XJ9qGt7h821Tno22ntchYBoMYUOs=; b=vnTY8PbdApuwFAXnhMFEntMyrjsgtGWnx7gJhlzdlrZJsFE8CplGxH1JQ2flwtncOi B3vC4PtaEEYkBDwAL0LsrSRJOMgfjfDFOnnryAmejDWhtxZgANmcgUuKGIIqaPjPJOTf lRQkRWo8qH8d5qr/pg2uaQYseh+K3tc32Ge4TJvLp8xkAckh+6e3h+BUkXutGXPpKHvd V2LE2GELsfTOP1EkchHv96yDc/rijSdVLdqzW8tTjZNGmvQeWjlvCZBOxhJJ0J2Ijii3 lvMeD28amGFd1Obu9Yk21DMNCt9iFWEY9QUl6yVOroPZpRFrA2VPp6ji4TjXZQreNC0g Tmzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728406141; x=1729010941; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NIKMlyZ2ZqwKuu4XJ9qGt7h821Tno22ntchYBoMYUOs=; b=rwetNna2qXzXEmA/BpslaSLKQY+RDfcEXtMEyD5mIj5dHKapFLaYxw5gHbWM2a22qg Xi254oNtPE1bcsKzjruzuK4IJWMjhLX0Wk/V2277QLIwDfN/tyWw4B7/LMmspTjwrC7H craw3YHC+NNc49nYzlAbND1DvrNRlXK1i7rKsp5aILZI91+q6exz2Q4s6GKtvIGQ+n1t djVRl4TdGKlStmDmwh108r1m3S2AFb4Cnutxic3rZaIYwnMxWR39YClk1mQidHfBmTUl rBWhAsDa02SWbWr7YDL6thmJSl5oXsjmjav89+X4fxKqEbovBPeH6wYKM1M7m2604G1F Dzyw== X-Gm-Message-State: AOJu0Yxm/nSiwJR81D/twlELr4g6KXhaDoOgJC84aaDPuivqjDdKmzEC +jGJEhRcat8KJTBCi2jtOnRrnY1IIvtFLj5zjpRbUbhC5pu90s5ejitsI5bl7CdPuMGlGENGb6d La8xghg== X-Google-Smtp-Source: AGHT+IE3Zk1jANQiS8LZArnbKEUp65vU+b7seZV/F4djAvqKzywMUkPg3u+Q5tPZh9reql71porqoQ== X-Received: by 2002:a17:903:32c4:b0:20b:c258:73af with SMTP id d9443c01a7336-20bff1cd62bmr206005955ad.51.1728406140686; Tue, 08 Oct 2024 09:49:00 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c54056bd9sm13832965ad.85.2024.10.08.09.49.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 09:49:00 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Ivan Malov , Andrew Rybchenko , Andy Moreton Subject: [PATCH v9 09/17] net/sfc: fix use-after-free warning messages Date: Tue, 8 Oct 2024 09:47:13 -0700 Message-ID: <20241008164842.139045-10-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241008164842.139045-1-stephen@networkplumber.org> References: <20240927204742.546164-1-stephen@networkplumber.org> <20241008164842.139045-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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") Signed-off-by: Stephen Hemminger Reviewed-by: Ivan Malov Acked-by: Andrew Rybchenko --- 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