All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: lariel@mellanox.com
Cc: linux-rdma@vger.kernel.org
Subject: [bug report] net/mlx5e: Support CT offload for tc nic flows
Date: Mon, 28 Sep 2020 13:15:05 +0300	[thread overview]
Message-ID: <20200928101505.GA382341@mwanda> (raw)

Hello Ariel Levkovich,

The patch aedd133d17bc: "net/mlx5e: Support CT offload for tc nic
flows" from Jul 21, 2020, leads to the following static checker
warning:

	drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:1132 mlx5e_tc_del_nic_flow()
	warn: passing freed memory 'flow'

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
  1105  static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
  1106                                    struct mlx5e_tc_flow *flow)
  1107  {
  1108          struct mlx5_flow_attr *attr = flow->attr;
  1109          struct mlx5e_tc_table *tc = &priv->fs.tc;
  1110  
  1111          flow_flag_clear(flow, OFFLOADED);
  1112  
  1113          if (flow_flag_test(flow, CT))
  1114                  mlx5_tc_ct_delete_flow(get_ct_priv(flow->priv), flow, attr);
                                                                        ^^^^
I guess this used to free "flow" and Smatch's db hasn't totally caught
up yet.  Now it doesn't use "flow" at all.  Maybe we could just remove
that parameter?

  1115          else if (!IS_ERR_OR_NULL(flow->rule[0]))
  1116                  mlx5e_del_offloaded_nic_rule(priv, flow->rule[0], attr);
  1117  
  1118          /* Remove root table if no rules are left to avoid
  1119           * extra steering hops.
  1120           */
  1121          mutex_lock(&priv->fs.tc.t_lock);
  1122          if (!mlx5e_tc_num_filters(priv, MLX5_TC_FLAG(NIC_OFFLOAD)) &&
  1123              !IS_ERR_OR_NULL(tc->t)) {
  1124                  mlx5_chains_put_table(nic_chains(priv), 0, 1, MLX5E_TC_FT_LEVEL);
  1125                  priv->fs.tc.t = NULL;
  1126          }
  1127          mutex_unlock(&priv->fs.tc.t_lock);
  1128  
  1129          kvfree(attr->parse_attr);
  1130  
  1131          if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
  1132                  mlx5e_detach_mod_hdr(priv, flow);
                                                   ^^^^
  1133  
  1134          mlx5_fc_destroy(priv->mdev, attr->counter);
  1135  
  1136          if (flow_flag_test(flow, HAIRPIN))
  1137                  mlx5e_hairpin_flow_del(priv, flow);
  1138  
  1139          kfree(flow->attr);
  1140  }

regards,
dan carpenter

             reply	other threads:[~2020-09-28 10:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 10:15 Dan Carpenter [this message]
2020-09-28 16:08 ` [bug report] net/mlx5e: Support CT offload for tc nic flows Ariel Levkovich

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=20200928101505.GA382341@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=lariel@mellanox.com \
    --cc=linux-rdma@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.