linux/net
Maxim Mikityanskiy a280312740 sch_api: Don't skip qdisc attach on ingress
commit de2d807b29 upstream.

The attach callback of struct Qdisc_ops is used by only a few qdiscs:
mq, mqprio and htb. qdisc_graft() contains the following logic
(pseudocode):

    if (!qdisc->ops->attach) {
        if (ingress)
            do ingress stuff;
        else
            do egress stuff;
    }
    if (!ingress) {
        ...
        if (qdisc->ops->attach)
            qdisc->ops->attach(qdisc);
    } else {
        ...
    }

As we see, the attach callback is not called if the qdisc is being
attached to ingress (TC_H_INGRESS). That wasn't a problem for mq and
mqprio, since they contain a check that they are attached to TC_H_ROOT,
and they can't be attached to TC_H_INGRESS anyway.

However, the commit cited below added the attach callback to htb. It is
needed for the hardware offload, but in the non-offload mode it
simulates the "do egress stuff" part of the pseudocode above. The
problem is that when htb is attached to ingress, neither "do ingress
stuff" nor attach() is called. It results in an inconsistency, and the
following message is printed to dmesg:

unregister_netdevice: waiting for lo to become free. Usage count = 2

This commit addresses the issue by running "do ingress stuff" in the
ingress flow even in the attach callback is present, which is fine,
because attach isn't going to be called afterwards.

The bug was found by syzbot and reported by Eric.

Fixes: d03b195b5a ("sch_htb: Hierarchical QoS hardware offload")
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reported-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-27 12:03:03 +01:00
..
6lowpan
9p 9p: fix a bunch of checkpatch warnings 2021-11-04 21:04:25 +09:00
802 llc/snap: constify dev_addr passing 2021-10-13 09:40:46 -07:00
8021q net: vlan: fix underflow for the real_dev refcnt 2021-11-26 11:20:46 -08:00
appletalk
atm net: atm: use address setting helpers 2021-10-24 13:59:45 +01:00
ax25 ax25: uninitialized variable in ax25_setsockopt() 2022-01-27 12:02:00 +01:00
batman-adv batman-adv: allow netlink usage in unprivileged containers 2022-01-27 12:02:14 +01:00
bluetooth Bluetooth: hci_sync: Fix not setting adv set duration 2022-01-27 12:02:52 +01:00
bpf bpf: Add dummy BPF STRUCT_OPS for test purpose 2021-11-01 14:10:00 -07:00
bpfilter
bridge netfilter: bridge: add support for pppoe filtering 2022-01-27 12:01:37 +01:00
caif net: caif: get ready for const netdev->dev_addr 2021-10-24 13:59:45 +01:00
can can: isotp: convert struct tpcon::{idx,len} to unsigned int 2022-01-16 09:11:14 +01:00
ceph libceph, ceph: move ceph_osdc_copy_from() into cephfs code 2021-11-08 03:29:52 +01:00
core net: fix sock_timestamping_bind_phc() to release device 2022-01-27 12:03:01 +01:00
dcb
dccp tcp: switch orphan_count to bare per-cpu counters 2021-10-15 11:28:34 +01:00
decnet
dns_resolver
dsa net: dsa: fix incorrect function pointer check for MRP ring roles 2022-01-27 12:01:54 +01:00
ethernet eth: platform: add a helper for loading netdev->dev_addr 2021-10-08 14:54:33 +01:00
ethtool ethtool: do not perform operations on net devices being unregistered 2021-12-06 16:53:32 -08:00
hsr net: hsr: Add support for redbox supervision frames 2021-10-26 14:52:17 +01:00
ieee802154 mac802154: use dev_addr_set() - manual 2021-10-20 14:27:40 +01:00
ife
ipv4 gre: Don't accidentally set RTO_ONLINK in gre_fill_metadata_dst() 2022-01-27 12:02:59 +01:00
ipv6 xfrm: fix policy lookup for ipv6 gre packets 2022-01-27 12:02:47 +01:00
iucv
kcm
key net: Remove unnecessary variables 2021-05-26 07:03:39 +02:00
l2tp net/l2tp: Fix reference count leak in l2tp_udp_recv_core 2021-09-09 11:00:20 +01:00
l3mdev
lapb
llc llc/snap: constify dev_addr passing 2021-10-13 09:40:46 -07:00
mac80211 mac80211: allow non-standard VHT MCS-10/11 2022-01-27 12:02:30 +01:00
mac802154 mac802154: use dev_addr_set() - manual 2021-10-20 14:27:40 +01:00
mctp mctp: test: zero out sockaddr 2022-01-27 12:02:58 +01:00
mpls net: mpls: Remove rcu protection from nh_dev 2021-11-29 12:39:42 +00:00
mptcp mptcp: Check reclaim amount before reducing allocation 2022-01-27 12:01:59 +01:00
ncsi net/ncsi: check for error return from call to nla_put_u32 2021-12-29 17:53:24 -08:00
netfilter netfilter: nft_set_pipapo: allocate pcpu scratch maps on clone 2022-01-27 12:01:55 +01:00
netlabel net: fix NULL pointer reference in cipso_v4_doi_free 2021-08-30 12:23:18 +01:00
netlink net: netlink: af_netlink: Prevent empty skb by adding a check on len. 2021-11-30 17:45:01 -08:00
netrom netrom: fix api breakage in nr_setsockopt() 2022-01-27 12:02:00 +01:00
nfc nfc: llcp: fix NULL error pointer dereference on sendmsg() after failed bind() 2022-01-27 12:01:17 +01:00
nsh
openvswitch net: openvswitch: Fix ct_state nat flags for conns arriving from tc 2022-01-27 12:02:01 +01:00
packet net/packet: rx_owner_map depends on pg_vec 2021-12-15 17:49:36 -08:00
phonet phonet/pep: refuse to enable an unbound pipe 2021-12-20 11:49:51 +00:00
psample psample: Add additional metadata attributes 2021-03-14 15:00:43 -07:00
qrtr net: qrtr: combine nameservice into main module 2021-09-28 17:36:43 -07:00
rds rds: memory leak in __rds_conn_create() 2021-12-14 12:51:52 +00:00
rfkill Another set of updates, all over the map: 2021-04-20 16:44:04 -07:00
rose rose: constify dev_addr passing 2021-10-13 09:40:45 -07:00
rxrpc rxrpc: Fix rxrpc_local leak in rxrpc_lookup_peer() 2021-11-29 15:40:02 +00:00
sched sch_api: Don't skip qdisc attach on ingress 2022-01-27 12:03:03 +01:00
sctp sctp: hold endpoint before calling cb in sctp_transport_lookup_process 2022-01-02 12:46:41 +00:00
smc net/smc: Fix hung_task when removing SMC-R devices 2022-01-27 12:02:57 +01:00
strparser bpf: sockmap, strparser, and tls are reusing qdisc_skb_cb and colliding 2021-11-09 01:05:28 +01:00
sunrpc SUNRPC: Fix sockaddr handling in the svc_xprt_create_error trace point 2022-01-27 12:02:40 +01:00
switchdev net: switchdev: merge switchdev_handle_fdb_{add,del}_to_device 2021-10-27 14:54:02 +01:00
tipc net ticp:fix a kernel-infoleak in __tipc_sendmsg() 2021-12-31 18:37:08 -08:00
tls net/tls: Fix authentication failure in CCM mode 2021-11-29 12:48:28 +00:00
unix af_unix: annote lockless accesses to unix_tot_inflight & gc_in_progress 2022-01-27 12:02:56 +01:00
vmw_vsock virtio/vsock: fix the transport to work with VMADDR_CID_ANY 2021-12-08 15:41:50 -05:00
wireless cfg80211: Acquire wiphy mutex on regulatory work 2021-12-14 11:20:11 +01:00
x25
xdp Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 2021-12-31 18:35:54 -08:00
xfrm xfrm: Don't accidentally set RTO_ONLINK in decode_session4() 2022-01-27 12:02:59 +01:00
Kconfig net/core: disable NET_RX_BUSY_POLL on PREEMPT_RT 2021-10-01 15:45:10 -07:00
Makefile
compat.c
devres.c
socket.c net: fix SOF_TIMESTAMPING_BIND_PHC to work with multiple sockets 2022-01-27 12:01:55 +01:00
sysctl_net.c sections: move and rename core_kernel_data() to is_kernel_core_data() 2021-11-09 10:02:50 -08:00