Browse Source

qcacld-3.0: Fix different flow RX packet aggregating on same fisa flow

Flow A packet is waiting napi_id 1 lock as it has passed metadata
and reo_id check in dp_add_nbuf_to_fisa_flow(), another flow B packet
FSE hash pointed to same FSE flow as flow A, but flow B packet is
coming from napi_id 2, current FISA LRU logic will allow flow B packet
hold napi_id 1 lock and update FSE flow to napi_id 2, then release
napi_id 1 lock. flow A and B packet will be added to same fisa flow,
skb double free or other issue will hit.

Move napi_id lock acquring before sanity check in
dp_add_nbuf_to_fisa_flow(), then different napi flow packet will
not be added to same FISA flow.

Change-Id: I2679972a0923d8cfba4f9d22182c1cc193b3f34f
CRs-Fixed: 3080877
Jinwei Chen 3 năm trước cách đây
mục cha
commit
08460fc2b7
1 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 4 4
      core/dp/txrx3.0/dp_fisa_rx.c

+ 4 - 4
core/dp/txrx3.0/dp_fisa_rx.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -1694,6 +1695,7 @@ static int dp_add_nbuf_to_fisa_flow(struct dp_rx_fst *fisa_hdl,
 		      nbuf, qdf_nbuf_next(nbuf), qdf_nbuf_data(nbuf), nbuf->len,
 		      nbuf->data_len);
 
+	 dp_rx_fisa_acquire_ft_lock(fisa_hdl, reo_id);
 	/* Packets of the flow are arriving on a different REO than
 	 * the one configured.
 	 */
@@ -1702,13 +1704,13 @@ static int dp_add_nbuf_to_fisa_flow(struct dp_rx_fst *fisa_hdl,
 			hal_rx_msdu_fse_metadata_get(hal_soc_hdl, rx_tlv_hdr);
 		if (fisa_hdl->del_flow_count &&
 		    fse_metadata != fisa_flow->metadata)
-			return FISA_AGGR_NOT_ELIGIBLE;
+			goto invalid_fisa_assist;
 
 		dp_err("REO id mismatch flow: %pK napi_id: %u nbuf: %pK reo_id: %u",
 		       fisa_flow, fisa_flow->napi_id, nbuf, napi_id);
 		DP_STATS_INC(fisa_hdl, reo_mismatch, 1);
 		QDF_BUG(0);
-		return FISA_AGGR_NOT_ELIGIBLE;
+		goto invalid_fisa_assist;
 	}
 
 	hal_cumulative_ip_len = hal_rx_get_fisa_cumulative_ip_length(
@@ -1719,8 +1721,6 @@ static int dp_add_nbuf_to_fisa_flow(struct dp_rx_fst *fisa_hdl,
 	hal_aggr_count = hal_rx_get_fisa_flow_agg_count(hal_soc_hdl,
 							rx_tlv_hdr);
 
-	dp_rx_fisa_acquire_ft_lock(fisa_hdl, reo_id);
-
 	if (!flow_aggr_cont) {
 		/* Start of new aggregation for the flow
 		 * Flush previous aggregates for this flow