From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH] kvm: x86: i8259: return initialized data on invalid-size read Date: Thu, 12 Mar 2015 22:02:59 -0300 Message-ID: <20150313010259.GB17648@amt.cnet> References: <20150311111609.GG8544@dhcp-25-225.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: kvm , Paolo Bonzini , Gleb Natapov , nadav.amit@gmail.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:44692 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752449AbbCMBDQ (ORCPT ); Thu, 12 Mar 2015 21:03:16 -0400 Content-Disposition: inline In-Reply-To: <20150311111609.GG8544@dhcp-25-225.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Mar 11, 2015 at 12:16:09PM +0100, Petr Matousek wrote: > If data is read from PIC with invalid access size, the return data stays > uninitialized even though success is returned. > > Fix this by always initializing the data. > > Signed-off-by: Petr Matousek > Reported-by: Nadav Amit > --- > arch/x86/kvm/i8259.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c > index cc31f7c..9541ba3 100644 > --- a/arch/x86/kvm/i8259.c > +++ b/arch/x86/kvm/i8259.c > @@ -507,6 +507,7 @@ static int picdev_read(struct kvm_pic *s, > return -EOPNOTSUPP; > > if (len != 1) { > + memset(val, 0, len); > pr_pic_unimpl("non byte read\n"); > return 0; > } > -- > 1.7.4.4 Applied, thanks.