public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NET: fix kernel panic from no dev->hard_header_len space
@ 2006-07-27 13:56 Krzysztof Halasa
  2006-07-27 16:43 ` Alexey Kuznetsov
  0 siblings, 1 reply; 19+ messages in thread
From: Krzysztof Halasa @ 2006-07-27 13:56 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

Hi,

ip_output() ignores dev->hard_header_len if dev->hard_header
function == NULL. It's inconsistent with the rest of the kernel. With
some drivers it would mean instant panic, but we are usually saved by
existence of the "default" header space.

With some bad luck things like tun or IPsec may kill the box.

A similar problem may be present in psched_mtu().

Please apply.
I think it should then be applied to stable series as well.

Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl>

diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index b94d1ad..3ae64ba 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -234,8 +234,7 @@ extern int tc_classify(struct sk_buff *s
  */
 static inline unsigned psched_mtu(struct net_device *dev)
 {
-	unsigned mtu = dev->mtu;
-	return dev->hard_header ? mtu + dev->hard_header_len : mtu;
+	return dev->mtu + dev->hard_header_len;
 }
 
 #endif
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index cff9c3a..f5d9051 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -169,7 +169,7 @@ static inline int ip_finish_output2(stru
 	int hh_len = LL_RESERVED_SPACE(dev);
 
 	/* Be paranoid, rather than too clever. */
-	if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) {
+	if (unlikely(skb_headroom(skb) < hh_len)) {
 		struct sk_buff *skb2;
 
 		skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));

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

end of thread, other threads:[~2006-08-02 21:11 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-27 13:56 [PATCH] NET: fix kernel panic from no dev->hard_header_len space Krzysztof Halasa
2006-07-27 16:43 ` Alexey Kuznetsov
2006-07-27 17:28   ` Krzysztof Halasa
2006-07-28 14:11     ` Krzysztof Halasa
2006-07-30 16:40   ` Krzysztof Halasa
2006-07-30 22:30     ` David Miller
2006-07-31 15:39       ` Alexey Kuznetsov
     [not found]         ` <m3r701zgku.fsf@defiant.localdomain>
2006-07-31 20:23           ` David Miller
2006-08-01  1:04             ` Krzysztof Halasa
2006-08-01  1:13               ` David Miller
2006-08-01  1:56                 ` Krzysztof Halasa
2006-08-01 19:54                   ` Alexey Kuznetsov
2006-08-02  0:24                     ` Krzysztof Halasa
2006-08-02  0:38                       ` David Miller
2006-08-02 21:11                         ` Krzysztof Halasa
2006-07-31 20:24           ` David Miller
2006-08-01 20:25     ` Alexey Kuznetsov
2006-08-02  0:42       ` Krzysztof Halasa
2006-08-02  0:48         ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox