Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'sch_cake-fixes'

Toke Høiland-Jørgensen says:

====================
sched: A few small fixes for sch_cake

Kevin noticed a few issues with the way CAKE reads the skb protocol and the IP
diffserv fields. This series fixes those two issues, and should probably go to
in 4.19 as well. However, the previous refactoring patch means they don't apply
as-is; I can send a follow-up directly to stable if that's OK with you?
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+12 -1
+12 -1
net/sched/sch_cake.c
··· 1517 1517 1518 1518 static u8 cake_handle_diffserv(struct sk_buff *skb, u16 wash) 1519 1519 { 1520 + int wlen = skb_network_offset(skb); 1520 1521 u8 dscp; 1521 1522 1522 - switch (skb->protocol) { 1523 + switch (tc_skb_protocol(skb)) { 1523 1524 case htons(ETH_P_IP): 1525 + wlen += sizeof(struct iphdr); 1526 + if (!pskb_may_pull(skb, wlen) || 1527 + skb_try_make_writable(skb, wlen)) 1528 + return 0; 1529 + 1524 1530 dscp = ipv4_get_dsfield(ip_hdr(skb)) >> 2; 1525 1531 if (wash && dscp) 1526 1532 ipv4_change_dsfield(ip_hdr(skb), INET_ECN_MASK, 0); 1527 1533 return dscp; 1528 1534 1529 1535 case htons(ETH_P_IPV6): 1536 + wlen += sizeof(struct ipv6hdr); 1537 + if (!pskb_may_pull(skb, wlen) || 1538 + skb_try_make_writable(skb, wlen)) 1539 + return 0; 1540 + 1530 1541 dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2; 1531 1542 if (wash && dscp) 1532 1543 ipv6_change_dsfield(ipv6_hdr(skb), INET_ECN_MASK, 0);