netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] [IPV4][IPV6][TCP] remove skb->dev NULL assignation in tcp_v[4|6]_rcv functions
@ 2008-02-07 11:17 Daniel Lezcano
  2008-02-07 11:45 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Lezcano @ 2008-02-07 11:17 UTC (permalink / raw)
  To: Linux Netdev List

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: rfc-why-dev-null.patch --]
[-- Type: text/x-patch, Size: 1148 bytes --]

Subject: [RFC] remove skb->dev NULL assignation
From: Daniel Lezcano <dlezcano@fr.ibm.com>

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 ?

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
 net/ipv4/tcp_ipv4.c |    2 --
 net/ipv6/tcp_ipv6.c |    2 --
 2 files changed, 4 deletions(-)

Index: net-2.6/net/ipv4/tcp_ipv4.c
===================================================================
--- net-2.6.orig/net/ipv4/tcp_ipv4.c
+++ 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)) {
Index: net-2.6/net/ipv6/tcp_ipv6.c
===================================================================
--- net-2.6.orig/net/ipv6/tcp_ipv6.c
+++ 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)) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] [IPV4][IPV6][TCP] remove skb->dev NULL assignation in tcp_v[4|6]_rcv functions
  2008-02-07 11:17 [RFC] [IPV4][IPV6][TCP] remove skb->dev NULL assignation in tcp_v[4|6]_rcv functions Daniel Lezcano
@ 2008-02-07 11:45 ` David Miller
  2008-02-07 11:56   ` Daniel Lezcano
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2008-02-07 11:45 UTC (permalink / raw)
  To: dlezcano; +Cc: netdev

From: Daniel Lezcano <dlezcano@fr.ibm.com>
Date: Thu, 07 Feb 2008 12:17:27 +0100

> 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 ?
> 
> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] [IPV4][IPV6][TCP] remove skb->dev NULL assignation in tcp_v[4|6]_rcv functions
  2008-02-07 11:45 ` David Miller
@ 2008-02-07 11:56   ` Daniel Lezcano
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2008-02-07 11:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

David Miller wrote:
> From: Daniel Lezcano <dlezcano@fr.ibm.com>
> Date: Thu, 07 Feb 2008 12:17:27 +0100
> 
>> 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 ?
>>
>> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
> 
> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-07 12:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-07 11:17 [RFC] [IPV4][IPV6][TCP] remove skb->dev NULL assignation in tcp_v[4|6]_rcv functions Daniel Lezcano
2008-02-07 11:45 ` David Miller
2008-02-07 11:56   ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).