Re: [PATCH] crypto: only wait for completion once

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

 



On Tue, Jan 14, 2020 at 2:47 PM Sebastian Andrzej Siewior
<bigeasy@xxxxxxxxxxxxx> wrote:
>
> On 2019-12-31 12:00:51 [+0200], John Mathew wrote:
> > Proposed fix for the swake_up_all_locked warnings issue discussed in
> > Link: https://lore.kernel.org/linux-rt-users/20191218165334.k4suur4gzlu62ibs@xxxxxxxxxxxxx/T/#t
> > Currently multiple wait for completions are scheduled for the same algo.
> > Only one completes and the rest are returned with ENOENT. This patch
> > checks for the name of the algorithm going to be waited up on, and if
> > the algorithm is already being waited for completion return EAGAIN ,
> > without accumulating completions and returning ENOENT.
>
> Have you tested this patch and if so how?
I ran the syzkaller for many days and was not able to reproduce the
hang, also no new issues were found.
Do you know any more tests for the crypto functionality?

>
> > Signed-off-by: John Mathew <john.mathew@xxxxxxxxxx>
> > ---
> >  crypto/api.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/crypto/api.c b/crypto/api.c
> > index d8ba54142620..1c6004e7ab6c 100644
> > --- a/crypto/api.c
> > +++ b/crypto/api.c
> > @@ -234,8 +234,12 @@ static struct crypto_alg *crypto_larval_lookup(const char *name, u32 type,
> >               alg = crypto_alg_lookup(name, type, mask);
> >       }
> >
> > -     if (!IS_ERR_OR_NULL(alg) && crypto_is_larval(alg))
> > -             alg = crypto_larval_wait(alg);
> > +     if (!IS_ERR_OR_NULL(alg) && crypto_is_larval(alg))      {
> > +             if (!strcmp(alg->cra_name, name))
> > +                     alg = ERR_PTR(-EAGAIN);
> > +             else
> > +                     alg = crypto_larval_wait(alg);
> > +     }
> >       else if (!alg)
> >               alg = crypto_larval_add(name, type, mask);
> >
> Sebastian



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux