diff options
author | Edward Cree <ecree.xilinx@gmail.com> | 2023-05-12 18:35:58 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-05-13 22:58:17 +0300 |
commit | befcc1fce564bdb20ee55be981a355b0a7d0eac5 (patch) | |
tree | ef33c16fd8d731ccd503c58d0387876f3cb0505d /drivers/net/ethernet/sfc/tc.c | |
parent | a0b7955310a445fc0d45a0ac576bad8720cd6057 (diff) | |
download | linux-befcc1fce564bdb20ee55be981a355b0a7d0eac5.tar.xz |
sfc: fix use-after-free in efx_tc_flower_record_encap_match()
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>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/tc.c')
-rw-r--r-- | drivers/net/ethernet/sfc/tc.c | 4 |
1 files 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; } |