Commit befcc1fc authored by Edward Cree's avatar Edward Cree Committed by David S. Miller

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: 3c9561c0 ("sfc: support TC decap rules matching on enc_ip_tos")
Reported-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a0b79553
...@@ -504,7 +504,7 @@ static int efx_tc_flower_record_encap_match(struct efx_nic *efx, ...@@ -504,7 +504,7 @@ static int efx_tc_flower_record_encap_match(struct efx_nic *efx,
if (em_type != EFX_TC_EM_PSEUDO_MASK) { if (em_type != EFX_TC_EM_PSEUDO_MASK) {
NL_SET_ERR_MSG_FMT_MOD(extack, NL_SET_ERR_MSG_FMT_MOD(extack,
"%s encap match conflicts with existing pseudo(MASK) entry", "%s encap match conflicts with existing pseudo(MASK) entry",
encap->type ? "Pseudo" : "Direct"); em_type ? "Pseudo" : "Direct");
return -EEXIST; return -EEXIST;
} }
if (child_ip_tos_mask != old->child_ip_tos_mask) { 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, ...@@ -525,7 +525,7 @@ static int efx_tc_flower_record_encap_match(struct efx_nic *efx,
default: /* Unrecognised pseudo-type. Just say no */ default: /* Unrecognised pseudo-type. Just say no */
NL_SET_ERR_MSG_FMT_MOD(extack, NL_SET_ERR_MSG_FMT_MOD(extack,
"%s encap match conflicts with existing pseudo(%d) entry", "%s encap match conflicts with existing pseudo(%d) entry",
encap->type ? "Pseudo" : "Direct", em_type ? "Pseudo" : "Direct",
old->type); old->type);
return -EEXIST; return -EEXIST;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment