Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84a38dee authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: qualcomm: rmnet: Don't pass coalesced packets with IP options"

parents 28f51b0f c3d8f723
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -781,9 +781,30 @@ static void rmnet_map_segment_coal_data(struct sk_buff *coal_skb,
	if (iph->version == 4) {
		protocol = iph->protocol;
		ip_len = iph->ihl * 4;

		/* Don't allow coalescing of any packets with IP options */
		if (iph->ihl != 5)
			gro = false;
	} else if (iph->version == 6) {
		__be16 frag_off;

		protocol = ((struct ipv6hdr *)iph)->nexthdr;
		ip_len = sizeof(struct ipv6hdr);
		ip_len = ipv6_skip_exthdr(coal_skb, sizeof(struct ipv6hdr),
					  &protocol, &frag_off);

		/* If we run into a problem, or this has a fragment header
		 * (which should technically not be possible, if the HW
		 * works as intended...), bail.
		 */
		if (ip_len < 0 || frag_off) {
			priv->stats.coal.coal_ip_invalid++;
			return;
		} else if (ip_len > sizeof(struct ipv6hdr)) {
			/* Don't allow coalescing of any packets with IPv6
			 * extension headers.
			 */
			gro = false;
		}
	} else {
		priv->stats.coal.coal_ip_invalid++;
		return;