Skip to content

Commit 3baf5c2

Browse files
committed
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>
2 parents aecfde2 + c87b4ec commit 3baf5c2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

net/sched/sch_cake.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,16 +1517,27 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)
15171517

15181518
static u8 cake_handle_diffserv(struct sk_buff *skb, u16 wash)
15191519
{
1520+
int wlen = skb_network_offset(skb);
15201521
u8 dscp;
15211522

1522-
switch (skb->protocol) {
1523+
switch (tc_skb_protocol(skb)) {
15231524
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+
15241530
dscp = ipv4_get_dsfield(ip_hdr(skb)) >> 2;
15251531
if (wash && dscp)
15261532
ipv4_change_dsfield(ip_hdr(skb), INET_ECN_MASK, 0);
15271533
return dscp;
15281534

15291535
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+
15301541
dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2;
15311542
if (wash && dscp)
15321543
ipv6_change_dsfield(ipv6_hdr(skb), INET_ECN_MASK, 0);

0 commit comments

Comments
 (0)