Skip to contentSkip to conversation

remove skb->dev NULL assignation in tcp_v[4|6]_rcv functions

RFC In review Daniel Lezcano 2 participants 3 messages Feb 7, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 remove skb->dev NULL assignation in tcp_v[4|6]_rcv functions

Subject: [RFC] remove skb->dev NULL assignation
From: Daniel Lezcano <[email protected]>

I was trying to figure out why in the tcp_v4_rcv/tcp_v6_rcv function, the skb->dev field is set to NULL. There is certainly a good reason, but I was not able to find it.

Is it possible to remove this ?

---
 net/ipv4/tcp_ipv4.c |    2 --
 net/ipv6/tcp_ipv6.c |    2 --
 2 files changed, 4 deletions(-)
net/ipv4/tcp_ipv4.c +0 -2
Index: net-2.6/net/ipv4/tcp_ipv4.c
===================================================================
@@ -1661,8 +1661,6 @@ process:
 	if (sk_filter(sk, skb))
 		goto discard_and_relse;
 
-	skb->dev = NULL;
-
 	bh_lock_sock_nested(sk);
 	ret = 0;
 	if (!sock_owned_by_user(sk)) {
net/ipv6/tcp_ipv6.c +0 -2
Index: net-2.6/net/ipv6/tcp_ipv6.c
===================================================================
@@ -1722,8 +1722,6 @@ process:
 	if (sk_filter(sk, skb))
 		goto discard_and_relse;
 
-	skb->dev = NULL;
-
 	bh_lock_sock_nested(sk);
 	ret = 0;
 	if (!sock_owned_by_user(sk)) {
maintainer
#1 lore raw

From: Daniel Lezcano <[email protected]>
Date: Thu, 07 Feb 2008 12:17:27 +0100

Quoted 9 lines

Subject: [RFC] remove skb->dev NULL assignation

I was trying to figure out why in the tcp_v4_rcv/tcp_v6_rcv function, the skb->dev field is set to NULL. There is certainly a good reason, but I was not able to find it.

Is it possible to remove this ?

It is illegal to reference a device outside of the netif_receive_skb() code path without taking a reference to it.

Since we are queueing it to a socket, we have to NULL out the skb->dev since thee packets lifetime is being expanded outside of that allowed window.

#2 lore raw
Quoted 11 lines · David Miller

From: Daniel Lezcano <[email protected]>
Date: Thu, 07 Feb 2008 12:17:27 +0100

Quoted 8 lines

Subject: [RFC] remove skb->dev NULL assignation

I was trying to figure out why in the tcp_v4_rcv/tcp_v6_rcv function, the skb->dev field is set to NULL. There is certainly a good reason, but I was not able to find it.

Is it possible to remove this ?

Quoted 8 lines
Quoted 1 line

It is illegal to reference a device outside of the netif_receive_skb() code path without taking a reference to it.

Since we are queueing it to a socket, we have to NULL out the skb->dev since thee packets lifetime is being expanded outside of that allowed window.

Got it. Thank you very much.