Subject: Re: [Patch net] act_ife: load meta modules before tcf_idr_check_alloc()

From: Vlad Buslov <[email-masked]>
Date: Mon, 07 Sep 2020 15:12:34 +0300

On Fri 04 Sep 2020 at 05:10, Cong Wang <[email-masked]> wrote:
> 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: [email-masked]
> Fixes: 0190c1d452a9 ("net: sched: atomically check-allocate action")
> Cc: Jamal Hadi Salim <[email-masked]>
> Cc: Vlad Buslov <[email-masked]>
> Cc: Jiri Pirko <[email-masked]>
> Signed-off-by: Cong Wang <[email-masked]>
> ---

Thanks for fixing this, Cong! I've verified that all tdc ife tests pass
with this patch.

Reviewed-by: Vlad Buslov <[email-masked]>
Tested-by: Vlad Buslov <[email-masked]>