android_kernel_sony_sdm845/net/sched
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Toke Høiland-Jørgensen dc61f90ad4 BACKPORT: sched: consistently handle layer3 header accesses in the presence of VLANs
[ Upstream commit d7bf2ebebc2bd61ab95e2a8e33541ef282f303d4 ]

There are a couple of places in net/sched/ that check skb->protocol and act
on the value there. However, in the presence of VLAN tags, the value stored
in skb->protocol can be inconsistent based on whether VLAN acceleration is
enabled. The commit quoted in the Fixes tag below fixed the users of
skb->protocol to use a helper that will always see the VLAN ethertype.

However, most of the callers don't actually handle the VLAN ethertype, but
expect to find the IP header type in the protocol field. This means that
things like changing the ECN field, or parsing diffserv values, stops
working if there's a VLAN tag, or if there are multiple nested VLAN
tags (QinQ).

To fix this, change the helper to take an argument that indicates whether
the caller wants to skip the VLAN tags or not. When skipping VLAN tags, we
make sure to skip all of them, so behaviour is consistent even in QinQ
mode.

To make the helper usable from the ECN code, move it to if_vlan.h instead
of pkt_sched.h.

v3:
- Remove empty lines
- Move vlan variable definitions inside loop in skb_protocol()
- Also use skb_protocol() helper in IP{,6}_ECN_decapsulate() and
  bpf_skb_ecn_set_ce()

v2:
- Use eth_type_vlan() helper in skb_protocol()
- Also fix code that reads skb->protocol directly
- Change a couple of 'if/else if' statements to switch constructs to avoid
  calling the helper twice

Reported-by: Ilya Ponetayev <i.ponetaev@ndmsystems.com>
Fixes: d8b9605d26 ("net: sched: fix skb->protocol use in case of accelerated vlan path")
Change-Id: I6ae5979ef672562b53ab8695ea13a6aea68e2d59
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sorayukii <sorayukii69@gmail.com>
2026-05-15 17:57:03 +07:00
..
act_api.c net: avoid potential infinite loop in tc_ctl_action() 2019-10-29 09:15:12 +01:00
act_bpf.c BACKPORT: bpf: rename bpf_compute_data_end into bpf_compute_data_pointers 2026-05-15 17:56:41 +07:00
act_connmark.c BACKPORT: sched: consistently handle layer3 header accesses in the presence of VLANs 2026-05-15 17:57:03 +07:00
act_csum.c BACKPORT: sched: consistently handle layer3 header accesses in the presence of VLANs 2026-05-15 17:57:03 +07:00
act_gact.c
act_ife.c ife: error out when nla attributes are empty 2019-08-11 12:22:18 +02:00
act_ipt.c
act_meta_mark.c
act_meta_skbprio.c
act_meta_skbtcindex.c
act_mirred.c UPSTREAM: bpf: reuse dev_is_mac_header_xmit for redirect 2026-05-15 17:54:15 +07:00
act_nat.c
act_pedit.c net/sched: act_pedit: fix WARN() in the traffic path 2019-11-28 18:28:04 +01:00
act_police.c
act_simple.c
act_skbedit.c BACKPORT: sched: consistently handle layer3 header accesses in the presence of VLANs 2026-05-15 17:57:03 +07:00
act_skbmod.c
act_tunnel_key.c
act_vlan.c
cls_api.c net: sched: prevent UAF on tc_ctl_tfilter when temporarily dropping rtnl_lock 2022-05-12 12:14:58 +02:00
cls_basic.c
cls_bpf.c BACKPORT: bpf: rename bpf_compute_data_end into bpf_compute_data_pointers 2026-05-15 17:56:41 +07:00
cls_cgroup.c
cls_flow.c BACKPORT: sched: consistently handle layer3 header accesses in the presence of VLANs 2026-05-15 17:57:03 +07:00
cls_flower.c BACKPORT: sched: consistently handle layer3 header accesses in the presence of VLANs 2026-05-15 17:57:03 +07:00
cls_fw.c
cls_matchall.c net/sched: matchall: add missing validation of TCA_MATCHALL_FLAGS 2020-02-28 15:42:44 +01:00
cls_route.c net_sched: cls_route: disallow handle of 0 2022-08-25 11:09:28 +02:00
cls_rsvp.c
cls_rsvp.h cls_rsvp: fix rsvp_policy 2020-02-14 16:30:58 -05:00
cls_rsvp6.c
cls_tcindex.c net: sched: fix warning in tcindex_alloc_perfect_hash 2021-07-20 16:21:03 +02:00
cls_u32.c
em_canid.c
em_cmp.c
em_ipset.c BACKPORT: sched: consistently handle layer3 header accesses in the presence of VLANs 2026-05-15 17:57:03 +07:00
em_meta.c BACKPORT: sched: consistently handle layer3 header accesses in the presence of VLANs 2026-05-15 17:57:03 +07:00
em_nbyte.c
em_text.c
em_u32.c
ematch.c net_sched: reject TCF_EM_SIMPLE case for complex ematch module 2023-01-07 12:07:30 +01:00
Kconfig
Makefile
sch_api.c BACKPORT: sched: consistently handle layer3 header accesses in the presence of VLANs 2026-05-15 17:57:03 +07:00
sch_atm.c
sch_blackhole.c
sch_cbq.c sch_cbq: validate TCA_CBQ_WRROPT to avoid crash 2019-10-07 18:53:24 +02:00
sch_choke.c net: sched: validate stab values 2021-03-30 14:41:42 +02:00
sch_codel.c net: sched: Fix a possible null-pointer dereference in dequeue_func() 2019-08-11 12:22:17 +02:00
sch_drr.c
sch_dsmark.c sch_dsmark: fix a NULL deref in qdisc_reset() 2021-06-03 08:23:33 +02:00
sch_fifo.c net_sched: fix NULL deref in fifo_set_limit() 2021-10-17 10:05:39 +02:00
sch_fq.c BACKPORT: tcp: internal implementation for pacing 2026-05-15 17:54:21 +07:00
sch_fq_codel.c fq_codel: fix TCA_FQ_CODEL_DROP_BATCH_SIZE sanity checks 2020-05-20 08:15:24 +02:00
sch_generic.c Merge remote-tracking branch 'common/android-4.9-q' into android12-4.9-sdm845 2022-03-31 22:52:51 +03:00
sch_gred.c net: sched: validate stab values 2021-03-30 14:41:42 +02:00
sch_hfsc.c
sch_hhf.c net/flow_dissector: switch to siphash 2019-11-10 11:23:31 +01:00
sch_htb.c
sch_ingress.c
sch_mq.c net: sched: fix tc -s class show no bstats on class with nolock subqueues 2019-12-05 15:35:30 +01:00
sch_mqprio.c net: sched: fix tc -s class show no bstats on class with nolock subqueues 2019-12-05 15:35:30 +01:00
sch_multiq.c net: sched: fix tc -s class show no bstats on class with nolock subqueues 2019-12-05 15:35:30 +01:00
sch_netem.c net: netem: correct the parent's backlog when corrupted packet was dropped 2020-01-29 10:24:34 +01:00
sch_pie.c
sch_plug.c
sch_prio.c Merge android-4.9.209(c830063) into msm-4.9 2020-03-13 15:47:19 +08:00
sch_qfq.c sch_qfq: prevent shift-out-of-bounds in qfq_init_qdisc 2022-01-11 13:38:12 +01:00
sch_red.c net: sched: Fix use after free in red_enqueue() 2022-11-10 15:46:05 +01:00
sch_sfb.c sch_sfb: Also store skb len before calling child enqueue 2022-09-15 12:39:46 +02:00
sch_sfq.c net: sched: validate stab values 2021-03-30 14:41:42 +02:00
sch_tbf.c net: create skb_gso_validate_mac_len() 2019-02-20 10:18:28 +01:00
sch_teql.c BACKPORT: sched: consistently handle layer3 header accesses in the presence of VLANs 2026-05-15 17:57:03 +07:00