From: Herbert Xu <herbert@gondor.apana.org.au>
To: Yunfeng Ye <yeyunfeng@huawei.com>
Cc: davem@davemloft.net, john.garry@huawei.com,
Jonathan.Cameron@huawei.com, mcgrof@kernel.org,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] crypto: hisilicon - Fix double free in sec_free_hw_sgl()
Date: Fri, 20 Sep 2019 23:00:12 +1000 [thread overview]
Message-ID: <20190920130012.GC23242@gondor.apana.org.au> (raw)
In-Reply-To: <c9c52443-59a6-f909-f98b-eddffe999c2b@huawei.com>
On Sun, Sep 15, 2019 at 05:26:56PM +0800, Yunfeng Ye wrote:
> There are two problems in sec_free_hw_sgl():
>
> First, when sgl_current->next is valid, @hw_sgl will be freed in the
> first loop, but it free again after the loop.
>
> Second, sgl_current and sgl_current->next_sgl is not match when
> dma_pool_free() is invoked, the third parameter should be the dma
> address of sgl_current, but sgl_current->next_sgl is the dma address
> of next chain, so use sgl_current->next_sgl is wrong.
>
> Fix this by deleting the last dma_pool_free() in sec_free_hw_sgl(),
> modifying the condition for while loop, and matching the address for
> dma_pool_free().
>
> Fixes: 915e4e8413da ("crypto: hisilicon - SEC security accelerator driver")
> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
> ---
> drivers/crypto/hisilicon/sec/sec_algs.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
All applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2019-09-20 13:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-15 9:26 Yunfeng Ye
2019-09-15 9:31 ` [PATCH 2/2] crypto: hisilicon - Matching the dma address for dma_pool_free() Yunfeng Ye
2019-09-20 13:00 ` Herbert Xu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190920130012.GC23242@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=Jonathan.Cameron@huawei.com \
--cc=davem@davemloft.net \
--cc=john.garry@huawei.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=yeyunfeng@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®