Browse Source

qcacld-3.0: add minimal UDP data length check for FISA

current observation is as following,
(1) RX UDP data length less then 12 bytes and they are aggregated
by FISA.
(2) aggregated UDP data might not be supported by user APP or they
are forwarded to other netdev.
if above two is met, kernel panic appears.

no solid conclusion from kernel network currently,
as a SW WAR from wlan driver side, check if current UDP data
length < 16 bytes, skip FISA aggregation.

Change-Id: Ia9e46705c7ace6a6e5580494231056adf214d7b2
CRs-Fixed: 3330035
Jinwei Chen 2 years ago
parent
commit
a1adfe5630

+ 5 - 0
components/dp/core/src/wlan_dp_fisa_rx.c

@@ -1653,6 +1653,10 @@ static bool dp_fisa_aggregation_should_stop(
 	l2_l3_hdr_len = l3_hdr_offset + l4_hdr_offset;
 
 	/**
+	 * kernel network panic if UDP data length < 12 bytes get aggregated,
+	 * no solid conclusion currently, as a SW WAR, only allow UDP
+	 * aggregation if UDP data length >= 16 bytes.
+	 *
 	 * current cumulative ip length should > last cumulative_ip_len
 	 * and <= last cumulative_ip_len + 1478, also current aggregate
 	 * count should be equal to last aggregate count + 1,
@@ -1661,6 +1665,7 @@ static bool dp_fisa_aggregation_should_stop(
 	 * otherwise, current fisa flow aggregation should be stopped.
 	 */
 	if (fisa_flow->do_not_aggregate ||
+	    msdu_len < (l2_l3_hdr_len + FISA_MIN_L4_AND_DATA_LEN) ||
 	    hal_cumulative_ip_len <= fisa_flow->hal_cumultive_ip_len ||
 	    cumulative_ip_len_delta > FISA_MAX_SINGLE_CUMULATIVE_IP_LEN ||
 	    (fisa_flow->last_hal_aggr_count + 1) != hal_aggr_count ||

+ 6 - 0
components/dp/core/src/wlan_dp_fisa_rx.h

@@ -38,6 +38,12 @@
 #define FISA_FLOW_MAX_CUMULATIVE_IP_LEN \
 	(FISA_MAX_SINGLE_CUMULATIVE_IP_LEN * FISA_FLOW_MAX_AGGR_COUNT)
 
+/* minimal pure UDP data length required for FISA */
+#define FISA_MIN_UDP_DATA_LEN 16
+/* minimal length without L2/L3 header required for FISA */
+#define FISA_MIN_L4_AND_DATA_LEN \
+	(FISA_UDP_HDR_LEN + FISA_MIN_UDP_DATA_LEN)
+
 #define IPSEC_PORT 500
 #define IPSEC_NAT_PORT 4500
 #define DNS_SERVER_PORT 53