Message ID | 202310160854+0800-wangjinchao@xfusion.com |
---|---|
State | Accepted |
Commit | 7ddc21e317b360c3444de3023bcc83b85fabae2f |
Headers | show |
Series | [v4] padata: Fix refcnt handling in padata_free_shell() | expand |
On Fri, Oct 20, 2023 at 01:03:59PM +0800, Herbert Xu wrote: > WangJinchao <wangjinchao@xfusion.com> wrote: > > diff --git a/kernel/padata.c b/kernel/padata.c > > index 222d60195de6..73108ac75f03 100644 > > --- a/kernel/padata.c > > +++ b/kernel/padata.c > > @@ -1102,12 +1102,15 @@ EXPORT_SYMBOL(padata_alloc_shell); > > */ > > void padata_free_shell(struct padata_shell *ps) > > { > > + struct parallel_data *pd; > > if (!ps) > > return; The \n after the declaration disappeared in this version but would be nice for consistency with the file. Maybe when applying, no need for another post. > Daniel, could you please reconfirm that you're still with v4? Yes, regardless of above, Acked-by: Daniel Jordan <daniel.m.jordan@oracle.com>
diff --git a/kernel/padata.c b/kernel/padata.c index 222d60195de6..73108ac75f03 100644 --- a/kernel/padata.c +++ b/kernel/padata.c @@ -1102,12 +1102,15 @@ EXPORT_SYMBOL(padata_alloc_shell); */ void padata_free_shell(struct padata_shell *ps) { + struct parallel_data *pd; if (!ps) return; mutex_lock(&ps->pinst->lock); list_del(&ps->list); - padata_free_pd(rcu_dereference_protected(ps->pd, 1)); + pd = rcu_dereference_protected(ps->pd, 1); + if (refcount_dec_and_test(&pd->refcnt)) + padata_free_pd(pd); mutex_unlock(&ps->pinst->lock); kfree(ps);