aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2013-11-21 14:11:47 -0500
committerBen Hutchings <bhutchings@solarflare.com>2013-12-12 17:07:24 -0500
commitf72848021d603846be8aed662bd23372c7d6688e (patch)
tree0f00651fea224462fdc224b97fa0240507d599bd /drivers/net/ethernet/sfc
parentb59e6ef87c337541c1c57742116d780813c9601c (diff)
sfc: Allow filter removal only with exactly matching priority
Currently a higher priority client can remove a lower priority client's filter with equal match-expression. This might happen if (a) the higher priority client has a double-free bug, or (b) another client with sufficient priority replaced and then removed an equal filter, allowing the low priority client to insert an equal filter. In neither case does it actually make sense to carry out the removal; we should say the filter doesn't exist, as the filter currently present is not the one that the high-priority client is referring to. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc')
-rw-r--r--drivers/net/ethernet/sfc/ef10.c2
-rw-r--r--drivers/net/ethernet/sfc/farch.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 2adc8e45461b..155602c500d5 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -2563,7 +2563,7 @@ static int efx_ef10_filter_remove_internal(struct efx_nic *efx,
2563 goto out_unlock; 2563 goto out_unlock;
2564 } 2564 }
2565 2565
2566 if (spec->priority > priority) { 2566 if (spec->priority != priority) {
2567 rc = -ENOENT; 2567 rc = -ENOENT;
2568 goto out_unlock; 2568 goto out_unlock;
2569 } 2569 }
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
index 378d6b968c4c..eed0741c2497 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -2543,7 +2543,7 @@ static int efx_farch_filter_remove(struct efx_nic *efx,
2543 struct efx_farch_filter_spec *spec = &table->spec[filter_idx]; 2543 struct efx_farch_filter_spec *spec = &table->spec[filter_idx];
2544 2544
2545 if (!test_bit(filter_idx, table->used_bitmap) || 2545 if (!test_bit(filter_idx, table->used_bitmap) ||
2546 spec->priority > priority) 2546 spec->priority != priority)
2547 return -ENOENT; 2547 return -ENOENT;
2548 2548
2549 if (spec->flags & EFX_FILTER_FLAG_RX_OVER_AUTO) { 2549 if (spec->flags & EFX_FILTER_FLAG_RX_OVER_AUTO) {