public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox•com>
To: "yuval.shaia@oracle•com" <yuval.shaia@oracle•com>,
	Matan Barak <matanb@mellanox•com>,
	Ilan Tayari <ilant@mellanox•com>,
	"gustavo@embeddedor•com" <gustavo@embeddedor•com>,
	Boris Pismenny <borisp@mellanox•com>,
	"leon@kernel•org" <leon@kernel•org>
Cc: "netdev@vger•kernel.org" <netdev@vger•kernel.org>,
	"linux-kernel@vger•kernel.org" <linux-kernel@vger•kernel.org>,
	"linux-rdma@vger•kernel.org" <linux-rdma@vger•kernel.org>
Subject: Re: [PATCH v2] net/mlx5: Fix use-after-free
Date: Thu, 22 Mar 2018 22:08:55 +0000	[thread overview]
Message-ID: <1521756532.8756.60.camel@mellanox.com> (raw)
In-Reply-To: <20180322184456.GA22259@embeddedgus>

On Thu, 2018-03-22 at 13:44 -0500, Gustavo A. R. Silva wrote:
> _rule_ is being freed and then dereferenced by accessing rule->ctx
> 
> Fix this by copying the value returned by PTR_ERR(rule->ctx) into a
> local
> variable for its safe use after freeing _rule_
> 
> Addresses-Coverity-ID: 1466041 ("Read from pointer after free")
> Fixes: 05564d0ae075 ("net/mlx5: Add flow-steering commands for FPGA
> IPSec implementation")
> Reviewed-by: Yuval Shaia <yuval.shaia@oracle•com>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor•com>

Acked-by: Saeed Mahameed <saeedm@mellanox•com>

> ---
> Changes in v2:
>  - Use a short subject prefix as suggested by Yuval Shaia.
>  - Add Yuval's Reviewed-by.
> 
>  drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
> b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
> index 4f15685..0f5da49 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
> @@ -1061,8 +1061,9 @@ static int fpga_ipsec_fs_create_fte(struct
> mlx5_core_dev *dev,
>  
>  	rule->ctx = mlx5_fpga_ipsec_fs_create_sa_ctx(dev, fte,
> is_egress);
>  	if (IS_ERR(rule->ctx)) {
> +		int err = PTR_ERR(rule->ctx);
>  		kfree(rule);
> -		return PTR_ERR(rule->ctx);
> +		return err;
>  	}
>  
>  	rule->fte = fte;

  reply	other threads:[~2018-03-22 22:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-22 18:44 [PATCH v2] net/mlx5: Fix use-after-free Gustavo A. R. Silva
2018-03-22 22:08 ` Saeed Mahameed [this message]
2018-03-23 17:06 ` David Miller

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=1521756532.8756.60.camel@mellanox.com \
    --to=saeedm@mellanox$(echo .)com \
    --cc=borisp@mellanox$(echo .)com \
    --cc=gustavo@embeddedor$(echo .)com \
    --cc=ilant@mellanox$(echo .)com \
    --cc=leon@kernel$(echo .)org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-rdma@vger$(echo .)kernel.org \
    --cc=matanb@mellanox$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=yuval.shaia@oracle$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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