From: Jiri Pirko <jiri@resnulli.us>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jiri Pirko <jiri@mellanox.com>,
Ido Schimmel <idosch@mellanox.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch -next] mlxsw: spectrum_router: fix a use after free
Date: Thu, 07 Jul 2016 08:39:22 +0000 [thread overview]
Message-ID: <20160707083922.GE2009@nanopsycho.orion> (raw)
In-Reply-To: <20160707082027.GB16742@mwanda>
Thu, Jul 07, 2016 at 10:20:28AM CEST, dan.carpenter@oracle.com wrote:
>mlxsw_sp_fib_entry_destroy() frees "fib_entry" but we dereference it on
>the next line.
>
>Fixes: 61c503f976b5 ('mlxsw: spectrum_router: Implement fib4 add/del switchdev obj ops')
>Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
>index e084ea5..adb481a 100644
>--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
>+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
>@@ -1652,8 +1652,8 @@ static void mlxsw_sp_router_fib4_add_info_destroy(void const *data)
> struct mlxsw_sp_fib_entry *fib_entry = info->fib_entry;
> struct mlxsw_sp *mlxsw_sp = info->mlxsw_sp;
To be consistent with the rest of the flows, I would rather do:
struct mlxsw_sp_vr *vr = fib_entry->vr;
mlxsw_sp_fib_entry_destroy(fib_entry);
mlxsw_sp_vr_put(mlxsw_sp, vr);
I can send the fix or I can leave it up to you. Thanks.
prev parent reply other threads:[~2016-07-07 8:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-07 8:20 [patch -next] mlxsw: spectrum_router: fix a use after free Dan Carpenter
2016-07-07 8:39 ` Jiri Pirko [this message]
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=20160707083922.GE2009@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=dan.carpenter@oracle.com \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox