All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: edward.cree@amd.com
Cc: linux-net-drivers@amd.com, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com,
	Edward Cree <ecree.xilinx@gmail.com>,
	netdev@vger.kernel.org, habetsm.xilinx@gmail.com
Subject: Re: [PATCH net-next] sfc: fix use-after-free in efx_tc_flower_record_encap_match()
Date: Fri, 12 May 2023 17:56:38 +0200	[thread overview]
Message-ID: <ZF5htreYutPyj67r@corigine.com> (raw)
In-Reply-To: <20230512153558.15025-1-edward.cree@amd.com>

On Fri, May 12, 2023 at 04:35:58PM +0100, edward.cree@amd.com wrote:
> From: Edward Cree <ecree.xilinx@gmail.com>
> 
> When writing error messages to extack for pseudo collisions, we can't
>  use encap->type as encap has already been freed.  Fortunately the
>  same value is stored in local variable em_type, so use that instead.
> 
> Fixes: 3c9561c0a5b9 ("sfc: support TC decap rules matching on enc_ip_tos")
> Reported-by: Simon Horman <simon.horman@corigine.com>
> Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>

Thanks,

Reviewed-by: Simon Horman <simon.horman@corigine.com>

> ---
>  drivers/net/ethernet/sfc/tc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/tc.c b/drivers/net/ethernet/sfc/tc.c
> index da684b4b7211..6dfbdb39f2fe 100644
> --- a/drivers/net/ethernet/sfc/tc.c
> +++ b/drivers/net/ethernet/sfc/tc.c
> @@ -504,7 +504,7 @@ static int efx_tc_flower_record_encap_match(struct efx_nic *efx,
>  			if (em_type != EFX_TC_EM_PSEUDO_MASK) {
>  				NL_SET_ERR_MSG_FMT_MOD(extack,
>  						       "%s encap match conflicts with existing pseudo(MASK) entry",
> -						       encap->type ? "Pseudo" : "Direct");
> +						       em_type ? "Pseudo" : "Direct");
>  				return -EEXIST;
>  			}
>  			if (child_ip_tos_mask != old->child_ip_tos_mask) {
> @@ -525,7 +525,7 @@ static int efx_tc_flower_record_encap_match(struct efx_nic *efx,
>  		default: /* Unrecognised pseudo-type.  Just say no */
>  			NL_SET_ERR_MSG_FMT_MOD(extack,
>  					       "%s encap match conflicts with existing pseudo(%d) entry",
> -					       encap->type ? "Pseudo" : "Direct",
> +					       em_type ? "Pseudo" : "Direct",
>  					       old->type);
>  			return -EEXIST;
>  		}
> 

  reply	other threads:[~2023-05-12 15:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 15:35 [PATCH net-next] sfc: fix use-after-free in efx_tc_flower_record_encap_match() edward.cree
2023-05-12 15:56 ` Simon Horman [this message]
2023-05-13 20:00 ` patchwork-bot+netdevbpf

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=ZF5htreYutPyj67r@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=edward.cree@amd.com \
    --cc=habetsm.xilinx@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-net-drivers@amd.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 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.