From: Dan Carpenter <dan.carpenter@oracle.com>
To: Saeed Mahameed <saeedm@nvidia.com>, Roi Dayan <roid@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] net/mlx5e: TC, Fix use after free in mlx5e_clone_flow_attr_for_post_act()
Date: Thu, 24 Feb 2022 17:53:25 +0300 [thread overview]
Message-ID: <20220224145325.GA6793@kili> (raw)
This returns freed memory leading to a use after free. It's supposed to
return NULL.
Fixes: 8300f225268b ("net/mlx5e: Create new flow attr for multi table actions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This goes through Saeed's tree not the net tree.
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 76a015dfc5fc..c0776a4a3845 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -3398,7 +3398,7 @@ mlx5e_clone_flow_attr_for_post_act(struct mlx5_flow_attr *attr,
if (!attr2 || !parse_attr) {
kvfree(parse_attr);
kfree(attr2);
- return attr2;
+ return NULL;
}
memcpy(attr2, attr, attr_sz);
--
2.20.1
next reply other threads:[~2022-02-24 14:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 14:53 Dan Carpenter [this message]
2022-02-25 12:18 ` [PATCH] net/mlx5e: TC, Fix use after free in mlx5e_clone_flow_attr_for_post_act() Roi Dayan
2022-03-01 7:16 ` 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=20220224145325.GA6793@kili \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=roid@nvidia.com \
--cc=saeedm@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).