Skip to content

Commit 16da090

Browse files
mkalderondavem330
authored andcommitted
qed: Fix non TCP packets should be dropped on iWARP ll2 connection
FW workaround. The iWARP LL2 connection did not expect TCP packets to arrive on it's connection. The fix drops any non-tcp packets Fixes b5c29ca ("qed: iWARP CM - setup a ll2 connection for handling SYN packets") Signed-off-by: Michal Kalderon <[email protected]> Signed-off-by: Ariel Elior <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 933e8c9 commit 16da090

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/net/ethernet/qlogic/qed/qed_iwarp.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,13 @@ qed_iwarp_parse_rx_pkt(struct qed_hwfn *p_hwfn,
17031703
iph = (struct iphdr *)((u8 *)(ethh) + eth_hlen);
17041704

17051705
if (eth_type == ETH_P_IP) {
1706+
if (iph->protocol != IPPROTO_TCP) {
1707+
DP_NOTICE(p_hwfn,
1708+
"Unexpected ip protocol on ll2 %x\n",
1709+
iph->protocol);
1710+
return -EINVAL;
1711+
}
1712+
17061713
cm_info->local_ip[0] = ntohl(iph->daddr);
17071714
cm_info->remote_ip[0] = ntohl(iph->saddr);
17081715
cm_info->ip_version = TCP_IPV4;
@@ -1711,6 +1718,14 @@ qed_iwarp_parse_rx_pkt(struct qed_hwfn *p_hwfn,
17111718
*payload_len = ntohs(iph->tot_len) - ip_hlen;
17121719
} else if (eth_type == ETH_P_IPV6) {
17131720
ip6h = (struct ipv6hdr *)iph;
1721+
1722+
if (ip6h->nexthdr != IPPROTO_TCP) {
1723+
DP_NOTICE(p_hwfn,
1724+
"Unexpected ip protocol on ll2 %x\n",
1725+
iph->protocol);
1726+
return -EINVAL;
1727+
}
1728+
17141729
for (i = 0; i < 4; i++) {
17151730
cm_info->local_ip[i] =
17161731
ntohl(ip6h->daddr.in6_u.u6_addr32[i]);

0 commit comments

Comments
 (0)