linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	KVM <kvm@vger.kernel.org>
Cc: Cornelia Huck <cohuck@redhat.com>,
	linux-s390 <linux-s390@vger.kernel.org>,
	Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Subject: Re: [PATCH 2/2] KVM: s390: prevent buffer overrun on memory hotplug during migration
Date: Thu, 21 Dec 2017 12:50:50 +0100	[thread overview]
Message-ID: <c110d930-48d7-b815-73dd-19236d420fae@redhat.com> (raw)
In-Reply-To: <20171221090416.17351-3-borntraeger@de.ibm.com>

On 21.12.2017 10:04, Christian Borntraeger wrote:
> We must not go beyond the pre-allocated buffer. This can happen when
> a new memory slot is added during migration.
> 
> Reported-by: David Hildenbrand <david@redhat.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: stable@vger.kernel.org # 4.13+
> Fixes: 190df4a212a7 (KVM: s390: CMMA tracking, ESSA emulation, migration mode)
> ---
>  arch/s390/kvm/priv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
> index c954ac49eee4..3211bf58d838 100644
> --- a/arch/s390/kvm/priv.c
> +++ b/arch/s390/kvm/priv.c
> @@ -1002,7 +1002,7 @@ static inline int do_essa(struct kvm_vcpu *vcpu, const int orc)
>  		cbrlo[entries] = gfn << PAGE_SHIFT;
>  	}
>  
> -	if (orc) {
> +	if (orc && gfn < ms->bitmap_size) {
>  		/* increment only if we are really flipping the bit to 1 */
>  		if (!test_and_set_bit(gfn, ms->pgste_bitmap))
>  			atomic64_inc(&ms->dirty_pages);
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David / dhildenb

  parent reply	other threads:[~2017-12-21 11:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21  9:04 [PATCH 0/2] KVM: s390: fixups for cmma migration (kvm/master) Christian Borntraeger
2017-12-21  9:04 ` [PATCH 1/2] KVM: s390: fix cmma migration for multiple memory slots Christian Borntraeger
2017-12-21  9:04 ` [PATCH 2/2] KVM: s390: prevent buffer overrun on memory hotplug during migration Christian Borntraeger
2017-12-21  9:36   ` Cornelia Huck
2017-12-21 11:50   ` David Hildenbrand [this message]
2017-12-21 11:57 ` [PATCH 0/2] KVM: s390: fixups for cmma migration (kvm/master) David Hildenbrand
2017-12-21 12:03   ` David Hildenbrand
2017-12-21 12:12     ` Christian Borntraeger
2017-12-21 12:26       ` Christian Borntraeger
2017-12-21 16:43         ` Cornelia Huck

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=c110d930-48d7-b815-73dd-19236d420fae@redhat.com \
    --to=david@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=imbrenda@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).