net_sched: check skb_transport_header_was_set() in qdisc_pkt_len_init()
Subsystems (2)
PATCH 1/1 net_sched: check skb_transport_header_was_set() in qdisc_pkt_len_init()
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.
--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
@@ -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;
Signature · 1 line
1.7.9.5
Quoted 19 lines · Matthew Rosato
commit
1def9238d4aa2(net_sched: more precisepkt_lencomputation) does not check to see ifskb_transport_headeris valid prior to using it inqdisc_pkt_len_init(), which can lead to a kernel panic ifskb_transport_headeris not valid butgso_sizeis nonzero. This patch adds a check forskb_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 <[email protected]>--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/core/dev.c +0
-0
net/core/dev.c static void qdisc_pkt_len_init(struct sk_buff *skb) · line 2602
Quoted 8 lines
net/core/dev.c +1
-1@@ -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;
Have you tried a recent kernel ?
I believe this was already discussed.
Please fix macvtap instead if its still buggy.
Quoted 31 lines · Eric Dumazet
Quoted 19 lines · Matthew Rosato
commit
1def9238d4aa2(net_sched: more precisepkt_lencomputation) does not check to see ifskb_transport_headeris valid prior to using it inqdisc_pkt_len_init(), which can lead to a kernel panic ifskb_transport_headeris not valid butgso_sizeis nonzero. This patch adds a check forskb_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 <[email protected]>--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/core/dev.c +0
-0net/core/dev.c static void qdisc_pkt_len_init(struct sk_buff *skb) · line 2602
Quoted 8 lines
net/core/dev.c +1
-1@@ -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;Have you tried a recent kernel ?
Quoted 1 line
I believe this was already discussed.
Mea Culpa. You are correct, I was missing a macvtap fix that already resolves this issue. For the sake of documentation, that fix is 9b4d669bc06c2 macvtap: set transport header before passing skb to lower device.
Applied and verified that problem is resolved. You can consider this patch withdrawn. Thanks.
Quoted 4 lines
Please fix macvtap instead if its still buggy.
Quoted 7 lines · Matthew Rosato
Mea Culpa. You are correct, I was missing a macvtap fix that already resolves this issue. For the sake of documentation, that fix is
9b4d669bc06c2macvtap: set transport header before passing skb to lower device.Applied and verified that problem is resolved. You can consider this patch withdrawn. Thanks.
Yes, and it was later a bit refined/cleaned-up
commit 40893fd0fd4e0eda8c6 ("net: switch to useskb_probe_transport_header()")
Thanks