Re: [PATCH] crypto: Demote BUG_ON() in crypto_unregister_alg() to a WARN_ON()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 12, 2023 at 03:27:10PM +0800, Herbert Xu wrote:
> On Sat, Mar 11, 2023 at 05:25:12PM +0100, Toke Høiland-Jørgensen wrote:
> >
> > diff --git a/crypto/algapi.c b/crypto/algapi.c
> > index d08f864f08be..e9954fcb61be 100644
> > --- a/crypto/algapi.c
> > +++ b/crypto/algapi.c
> > @@ -493,7 +493,7 @@ void crypto_unregister_alg(struct crypto_alg *alg)
> >  	if (WARN(ret, "Algorithm %s is not registered", alg->cra_driver_name))
> >  		return;
> >  
> > -	BUG_ON(refcount_read(&alg->cra_refcnt) != 1);
> > +	WARN_ON(refcount_read(&alg->cra_refcnt) != 1);
> 
> I think we should return here instead of continuing to destroy
> the algorithm since we know that it's still in use.

Also, this still panics a box with panic-on-warn enabled, so if this can
be handled, returning an error is good.

thanks,

greg k-h



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux