From 5ceb4a1e953e6fa0cea4e694ba0ac7ef11a2ddeb Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Fri, 1 Oct 2004 20:09:49 +0000 Subject: [PATCH] - Fix thinko. Bypass xid checks if socket was created in the root context, like the freaking comment says. --- include/net/sock.h | 2 +- net/ipv4/tcp_ipv4.c | 2 +- net/packet/af_packet.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index a2aba080f..0d3da11ec 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1086,7 +1086,7 @@ static inline int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) * packet. */ if (inet_stream_ops.bind != inet_bind && - (int) sk->sk_xid >= 0 && sk->sk_xid != skb->xid) + (int) sk->sk_xid > 0 && sk->sk_xid != skb->xid) goto out; /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 7bbe1cb55..70945b48a 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1822,7 +1822,7 @@ process: * packet. */ if (inet_stream_ops.bind != inet_bind && - (int) sk->sk_xid >= 0 && sk->sk_xid != skb->xid) + (int) sk->sk_xid > 0 && sk->sk_xid != skb->xid) goto discard_it; if (sk->sk_state == TCP_TIME_WAIT) diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 5edc92cf8..844a087b0 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -451,7 +451,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packe sk = pt->af_packet_priv; po = pkt_sk(sk); - if (sk->sk_xid && sk->sk_xid != skb->xid) + if ((int) sk->sk_xid > 0 && sk->sk_xid != skb->xid) goto drop; skb->dev = dev; -- 2.47.0