• Pedro Tammela's avatar
    net/sched: wrap open coded Qdics class filter counter · 8798481b
    Pedro Tammela authored
    The 'filter_cnt' counter is used to control a Qdisc class lifetime.
    Each filter referecing this class by its id will eventually
    increment/decrement this counter in their respective
    'add/update/delete' routines.
    As these operations are always serialized under rtnl lock, we don't
    need an atomic type like 'refcount_t'.
    
    It also means that we lose the overflow/underflow checks already
    present in refcount_t, which are valuable to hunt down bugs
    where the unsigned counter wraps around as it aids automated tools
    like syzkaller to scream in such situations.
    
    Wrap the open coded increment/decrement into helper functions and
    add overflow checks to the operations.
    Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
    Signed-off-by: default avatarPedro Tammela <pctammela@mojatatu.com>
    Reviewed-by: default avatarSimon Horman <horms@kernel.org>
    Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    8798481b
sch_qfq.c 41.6 KB