From: "Daniel P. Berrange" <berrange@redhat.com>
To: "Longpeng (Mike)" <longpeng2@huawei.com>
Cc: Eric Blake <eblake@redhat.com>,
pbonzini@redhat.com, arei.gonglei@huawei.com,
qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] crypto: afalg: fix a NULL pointer dereference
Date: Tue, 7 Nov 2017 09:16:17 +0000 [thread overview]
Message-ID: <20171107091617.GC14232@redhat.com> (raw)
In-Reply-To: <5A0119FE.6060709@huawei.com>
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.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2017-11-07 9:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 6:21 [Qemu-devel] [PATCH] crypto: afalg: fix a NULL pointer dereference Longpeng(Mike)
2017-11-06 10:21 ` Gonglei (Arei)
2017-11-06 17:00 ` Eric Blake
2017-11-07 2:27 ` Longpeng (Mike)
2017-11-07 9:16 ` Daniel P. Berrange [this message]
2017-11-07 9:32 ` Longpeng (Mike)
2017-11-06 17:18 ` Stefan Hajnoczi
2017-11-07 1:13 ` Longpeng (Mike)
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=20171107091617.GC14232@redhat.com \
--to=berrange@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=longpeng2@huawei.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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;
as well as URLs for NNTP newsgroup(s).