File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -3670,15 +3670,21 @@ static void pwq_unbound_release_workfn(struct work_struct *work)
3670
3670
unbound_release_work );
3671
3671
struct workqueue_struct * wq = pwq -> wq ;
3672
3672
struct worker_pool * pool = pwq -> pool ;
3673
- bool is_last ;
3673
+ bool is_last = false ;
3674
3674
3675
- if (WARN_ON_ONCE (!(wq -> flags & WQ_UNBOUND )))
3676
- return ;
3675
+ /*
3676
+ * when @pwq is not linked, it doesn't hold any reference to the
3677
+ * @wq, and @wq is invalid to access.
3678
+ */
3679
+ if (!list_empty (& pwq -> pwqs_node )) {
3680
+ if (WARN_ON_ONCE (!(wq -> flags & WQ_UNBOUND )))
3681
+ return ;
3677
3682
3678
- mutex_lock (& wq -> mutex );
3679
- list_del_rcu (& pwq -> pwqs_node );
3680
- is_last = list_empty (& wq -> pwqs );
3681
- mutex_unlock (& wq -> mutex );
3683
+ mutex_lock (& wq -> mutex );
3684
+ list_del_rcu (& pwq -> pwqs_node );
3685
+ is_last = list_empty (& wq -> pwqs );
3686
+ mutex_unlock (& wq -> mutex );
3687
+ }
3682
3688
3683
3689
mutex_lock (& wq_pool_mutex );
3684
3690
put_unbound_pool (pool );
You can’t perform that action at this time.
0 commit comments