[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] crypto: afalg: fix a NULL pointer dereference
From: |
Longpeng (Mike) |
Subject: |
Re: [Qemu-devel] [PATCH] crypto: afalg: fix a NULL pointer dereference |
Date: |
Tue, 7 Nov 2017 17:32:52 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 |
On 2017/11/7 17:16, Daniel P. Berrange wrote:
> On Tue, Nov 07, 2017 at 10:27:10AM +0800, Longpeng (Mike) wrote:
>>
>>
>> On 2017/11/7 1:00, Eric Blake wrote:
>>
>>> On 11/06/2017 12:21 AM, Longpeng(Mike) wrote:
>>>> Test-crypto-hash calls qcrypto_hash_bytesv/digest/base64 with
>>>> errp=NULL, this will cause a NULL poniter deference if afalg_driver
>>>
>>> s/poniter deference/pointer dereference/
>>>
>>
>> OK.
>>
>>>> doesn't support requested algos:
>>>> ret = qcrypto_hash_afalg_driver.hash_bytesv(alg, iov, niov,
>>>> result, resultlen,
>>>> errp);
>>>> if (ret == 0) {
>>>> return ret;
>>>> }
>>>>
>>>> error_free(*errp); // <--- here
>>>>
>>>> So we must check 'errp & *errp' before dereference.
>>>
>>> No, if we are going to blindly ignore the error from the hash_bytesv()
>>> call, then we should pass NULL rather than errp.
>>>
>>
>> The 'errp' in this palce is convenient for debug, it can tell us the reason
>> for
>> failure without stepping into afalg_driver's hash_bytesv().
>
> It doesn't do anything useful for debug, because we are just immediately
> throwing away the error without printing it anywhere. Just pass NULL into
> the hash_bytesv call above.
>
OK..
Afalg-backend cipher/hmac has the same usage, so maybe I need to correct all of
them.
> Regards,
> Daniel
--
Regards,
Longpeng(Mike)