public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: "Longpeng(Mike)" <longpeng2@huawei.com>,
	linux-crypto@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Cc: Corentin Labbe <clabbe@baylibre.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Gonglei <arei.gonglei@huawei.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 1/2] crypto: virtio: Fix src/dst scatterlist calculation in __virtio_crypto_skcipher_do_req()
Date: Tue, 26 May 2020 09:03:21 +0200	[thread overview]
Message-ID: <d58a046a-e559-55be-16ba-64db43a06568@web.de> (raw)
In-Reply-To: <20200526031956.1897-2-longpeng2@huawei.com>

> Fix it by sg_next() on calculation of src/dst scatterlist.

Wording adjustment:
… by calling the function “sg_next” …


…
> +++ b/drivers/crypto/virtio/virtio_crypto_algs.c
> @@ -350,13 +350,18 @@ __virtio_crypto_skcipher_do_req(struct virtio_crypto_sym_request *vc_sym_req,
>  	src_nents = sg_nents_for_len(req->src, req->cryptlen);
> +	if (src_nents < 0) {
> +		pr_err("Invalid number of src SG.\n");
> +		return src_nents;
> +	}
> +
>  	dst_nents = sg_nents(req->dst);
…

I suggest to move the addition of such input parameter validation
to a separate update step.

Regards,
Markus

  reply	other threads:[~2020-05-26  7:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26  3:19 [PATCH v2 0/2] crypto: virtio: Fix two crash issue Longpeng(Mike)
2020-05-26  3:19 ` [PATCH v2 1/2] crypto: virtio: Fix src/dst scatterlist calculation in __virtio_crypto_skcipher_do_req() Longpeng(Mike)
2020-05-26  7:03   ` Markus Elfring [this message]
2020-05-26  7:21     ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
2020-05-26  8:25       ` [v2 " Markus Elfring
2020-05-26 14:11   ` [PATCH v2 " Sasha Levin
2020-05-26  3:19 ` [PATCH v2 2/2] crypto: virtio: Fix use-after-free in virtio_crypto_skcipher_finalize_req() Longpeng(Mike)
2020-05-26  7:19   ` Markus Elfring
2020-05-26  7:38     ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
2020-05-26  9:01       ` [v2 " Markus Elfring
2020-05-26  9:24         ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
2020-05-26  9:30           ` Markus Elfring
2020-05-26 10:16           ` Greg KH
2020-05-26 12:00   ` [PATCH v2 " Gonglei (Arei)
2020-05-26 14:11   ` Sasha Levin
2020-05-31  9:21     ` Michael S. Tsirkin
2020-06-02  3:54       ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)

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=d58a046a-e559-55be-16ba-64db43a06568@web.de \
    --to=markus.elfring@web.de \
    --cc=arei.gonglei@huawei.com \
    --cc=clabbe@baylibre.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jasowang@redhat.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longpeng2@huawei.com \
    --cc=mst@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /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