Browse Source

Merge branch 'sfc-more-ARFS-fixes'

Edward Cree says:

====================
sfc: more ARFS fixes

A couple more bits of breakage in my recent ARFS and async filters work.
Patch #1 in particular fixes a bug that leads to memory trampling and
 consequent crashes.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller 7 years ago
parent
commit
1d39fd1bed
2 changed files with 5 additions and 2 deletions
  1. 3 2
      drivers/net/ethernet/sfc/ef10.c
  2. 2 0
      drivers/net/ethernet/sfc/rx.c

+ 3 - 2
drivers/net/ethernet/sfc/ef10.c

@@ -4784,8 +4784,9 @@ expire:
 	 * will set rule->filter_id to EFX_ARFS_FILTER_ID_PENDING, meaning that
 	 * will set rule->filter_id to EFX_ARFS_FILTER_ID_PENDING, meaning that
 	 * the rule is not removed by efx_rps_hash_del() below.
 	 * the rule is not removed by efx_rps_hash_del() below.
 	 */
 	 */
-	ret = efx_ef10_filter_remove_internal(efx, 1U << spec->priority,
-					      filter_idx, true) == 0;
+	if (ret)
+		ret = efx_ef10_filter_remove_internal(efx, 1U << spec->priority,
+						      filter_idx, true) == 0;
 	/* While we can't safely dereference rule (we dropped the lock), we can
 	/* While we can't safely dereference rule (we dropped the lock), we can
 	 * still test it for NULL.
 	 * still test it for NULL.
 	 */
 	 */

+ 2 - 0
drivers/net/ethernet/sfc/rx.c

@@ -839,6 +839,8 @@ static void efx_filter_rfs_work(struct work_struct *data)
 	int rc;
 	int rc;
 
 
 	rc = efx->type->filter_insert(efx, &req->spec, true);
 	rc = efx->type->filter_insert(efx, &req->spec, true);
+	if (rc >= 0)
+		rc %= efx->type->max_rx_ip_filters;
 	if (efx->rps_hash_table) {
 	if (efx->rps_hash_table) {
 		spin_lock_bh(&efx->rps_hash_lock);
 		spin_lock_bh(&efx->rps_hash_lock);
 		rule = efx_rps_hash_find(efx, &req->spec);
 		rule = efx_rps_hash_find(efx, &req->spec);