From: Colin Ian King <colin.king@canonical.com>
To: Ariel Levkovich <lariel@mellanox.com>,
Roi Dayan <roid@mellanox.com>, Vlad Buslov <vladbu@nvidia.com>,
Saeed Mahameed <saeedm@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
linux-rdma@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: net/mlx5: Refactor tc flow attributes structure
Date: Mon, 28 Sep 2020 17:06:41 +0100 [thread overview]
Message-ID: <763ea1c6-ed2b-3487-113f-fb48c1cf27dc@canonical.com> (raw)
Hi,
static analysis with Coverity has found a null pointer dereference issue
with the following commit:
commit c620b772152b8274031083bdb2e11c963e596c5c
Author: Ariel Levkovich <lariel@mellanox.com>
Date: Thu Apr 30 05:54:08 2020 +0300
net/mlx5: Refactor tc flow attributes structure
The analysis is as follows:
1240 slow_attr = mlx5_alloc_flow_attr(MLX5_FLOW_NAMESPACE_FDB);
1. Condition !slow_attr, taking true branch.
2. var_compare_op: Comparing slow_attr to null implies that
slow_attr might be null.
1241 if (!slow_attr)
1242 mlx5_core_warn(flow->priv->mdev, "Unable to
unoffload slow path rule\n");
1243
1244 memcpy(slow_attr, flow->attr, ESW_FLOW_ATTR_SZ);
Dereference after null check (FORWARD_NULL)
3. var_deref_op: Dereferencing null pointer slow_attr.
1245 slow_attr->action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
1246 slow_attr->esw_attr->split_count = 0;
1247 slow_attr->flags |= MLX5_ESW_ATTR_FLAG_SLOW_PATH;
1248 mlx5e_tc_unoffload_fdb_rules(esw, flow, slow_attr);
1249 flow_flag_clear(flow, SLOW);
1250 kfree(slow_attr);
there is a !slow_attr check but if it slow_attr is null the code then
dereferences it multiple times afterwards.
Colin
next reply other threads:[~2020-09-28 16:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-28 16:06 Colin Ian King [this message]
2020-09-28 23:25 ` net/mlx5: Refactor tc flow attributes structure Saeed Mahameed
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=763ea1c6-ed2b-3487-113f-fb48c1cf27dc@canonical.com \
--to=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=lariel@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=roid@mellanox.com \
--cc=saeedm@mellanox.com \
--cc=vladbu@nvidia.com \
/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).