• Cong Wang's avatar
    act_ife: load meta modules before tcf_idr_check_alloc() · cc8e58f8
    Cong Wang authored
    The following deadlock scenario is triggered by syzbot:
    
    Thread A:				Thread B:
    tcf_idr_check_alloc()
    ...
    populate_metalist()
      rtnl_unlock()
    					rtnl_lock()
    					...
      request_module()			tcf_idr_check_alloc()
      rtnl_lock()
    
    At this point, thread A is waiting for thread B to release RTNL
    lock, while thread B is waiting for thread A to commit the IDR
    change with tcf_idr_insert() later.
    
    Break this deadlock situation by preloading ife modules earlier,
    before tcf_idr_check_alloc(), this is fine because we only need
    to load modules we need potentially.
    
    Reported-and-tested-by: syzbot+80e32b5d1f9923f8ace6@syzkaller.appspotmail.com
    Fixes: 0190c1d4 ("net: sched: atomically check-allocate action")
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Cc: Vlad Buslov <vladbu@mellanox.com>
    Cc: Jiri Pirko <jiri@resnulli.us>
    Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    cc8e58f8
act_ife.c 20.9 KB