Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F164505223
D58325.id182179.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D58325.id182179.diff
View Options
diff --git a/sys/dev/irdma/irdma_utils.c b/sys/dev/irdma/irdma_utils.c
--- a/sys/dev/irdma/irdma_utils.c
+++ b/sys/dev/irdma/irdma_utils.c
@@ -1521,16 +1521,40 @@
buf->ipv4 = (info->l3proto) ? false : true;
buf->iph = mem + buf->maclen;
iph = (struct ip *)buf->iph;
- buf->tcph = buf->iph + iphlen;
- tcph = (struct tcphdr *)buf->tcph;
-
if (buf->ipv4) {
+ if (iph->ip_hl < 5) {
+ irdma_debug(buf->vsi->dev, IRDMA_DEBUG_ERR,
+ "ip header_len 0x%x too small\n",
+ iph->ip_hl << 2);
+ return -EINVAL;
+ }
+ if (iphlen != (iph->ip_hl << 2)) {
+ irdma_debug(buf->vsi->dev, IRDMA_DEBUG_ERR,
+ "ip header_len 0x%x unexpected, options present\n",
+ iph->ip_hl << 2);
+ return -EINVAL;
+ }
+ if (iph->ip_p != IPPROTO_TCP) {
+ irdma_debug(buf->vsi->dev, IRDMA_DEBUG_ERR,
+ "protocol 0x%x unexpected\n",
+ iph->ip_p);
+ return -EINVAL;
+ }
pkt_len = ntohs(iph->ip_len);
} else {
ip6h = (struct ip6_hdr *)buf->iph;
+ if (ip6h->ip6_un1_nxt != IPPROTO_TCP) {
+ irdma_debug(buf->vsi->dev, IRDMA_DEBUG_ERR,
+ "protocol 0x%x unexpected\n",
+ ip6h->ip6_unl_nxt);
+ return -EINVAL;
+ }
pkt_len = ntohs(ip6h->ip6_plen) + iphlen;
}
+ buf->tcph = buf->iph + iphlen;
+ tcph = (struct tcphdr *)buf->tcph;
+
buf->totallen = pkt_len + buf->maclen;
if (info->payload_len < buf->totallen) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 2, 12:56 PM (11 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35236618
Default Alt Text
D58325.id182179.diff (1 KB)
Attached To
Mode
D58325: irdma: improve validation checks further
Attached
Detach File
Event Timeline
Log In to Comment