netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net_sched: check skb_transport_header_was_set() in qdisc_pkt_len_init()
@ 2013-05-20 18:47 Matthew Rosato
  2013-05-20 18:58 ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Rosato @ 2013-05-20 18:47 UTC (permalink / raw)
  To: davem; +Cc: netdev, eric.dumazet

commit 1def9238d4aa2 (net_sched: more precise pkt_len computation) does
not check to see if skb_transport_header is valid prior to using it in
qdisc_pkt_len_init(), which can lead to a kernel panic if
skb_transport_header is not valid but gso_size is nonzero.  This patch
adds a check for skb_transport_header_was_set().

I managed to hit this scenario by driving a burst of traffic from a
qemu guest through a macvtap interface, causing a panic in the host kernel.

Signed-off-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
---
 net/core/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index fc1e289..5d0d3af 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2596,7 +2596,7 @@ static void qdisc_pkt_len_init(struct sk_buff *skb)
 	/* To get more precise estimation of bytes sent on wire,
 	 * we add to pkt_len the headers size of all segments
 	 */
-	if (shinfo->gso_size)  {
+	if (shinfo->gso_size && skb_transport_header_was_set(skb))  {
 		unsigned int hdr_len;
 		u16 gso_segs = shinfo->gso_segs;
 
-- 
1.7.9.5

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

end of thread, other threads:[~2013-05-20 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-20 18:47 [PATCH] net_sched: check skb_transport_header_was_set() in qdisc_pkt_len_init() Matthew Rosato
2013-05-20 18:58 ` Eric Dumazet
2013-05-20 20:32   ` Matthew Rosato
2013-05-20 20:37     ` Eric Dumazet

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).