Re: [PATCH v3 3/6] crypto/realtek: hash algorithms

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

 



Markus Stockhausen <markus.stockhausen@xxxxxx> wrote:
>
> +       while (datalen) {
> +               len = min(sg_dma_len(sg), datalen);
> +
> +               idx = rtcr_inc_src_idx(idx, 1);
> +               rtcr_add_src_to_ring(cdev, idx, sg_virt(sg), len, reqlen);

You cannot use sg_virt because the SG might not even be mapped
into kernel address space.  Since the code then simply converts
it to physical you should simply pass along the DMA address you
obtained from the DMA API.

> +
> +               datalen -= len;
> +               if (datalen)
> +                       sg = sg_next(sg);
> +       }
> +
> +       if (padlen) {
> +               idx = rtcr_inc_src_idx(idx, 1);
> +               rtcr_add_src_to_ring(cdev, idx, ppad, padlen, reqlen);
> +       }
> +
> +       rtcr_add_src_pad_to_ring(cdev, idx, reqlen);
> +       rtcr_add_src_ahash_to_ring(cdev, srcidx, hctx->opmode, reqlen);
> +
> +       /* Off we go */
> +       rtcr_kick_engine(cdev);
> +       if (rtcr_wait_for_request(cdev, dstidx))
> +               return -EINVAL;

You cannot sleep in this function because it may be called from
softirq context.  Instead you should use asynchronous completion.

Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux