From: Ian Campbell Subject: Re: [PATCH] linux-2.6.18/xenbus: fix overflow check in xenbus_dev_write() Date: Tue, 16 Oct 2012 14:00:03 +0100 Message-ID: <1350392403.18058.116.camel@zakaz.uk.xensource.com> References: <507D6CCC02000078000A1B07@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <507D6CCC02000078000A1B07@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Konrad Rzeszutek Wilk , xen-devel List-Id: xen-devel@lists.xenproject.org On Tue, 2012-10-16 at 13:18 +0100, Jan Beulich wrote: > Reported-by: Dan Carpenter > Signed-off-by: Jan Beulich Acked-by: Ian Campbell CC-ing Konrad since I think that modulo tweaking the path this ought to apply as is to upstream kernels. > > --- a/drivers/xen/xenbus/xenbus_dev.c > +++ b/drivers/xen/xenbus/xenbus_dev.c > @@ -239,7 +239,7 @@ static ssize_t xenbus_dev_write(struct f > if (!is_xenstored_ready()) > return -ENODEV; > > - if ((len + u->len) > sizeof(u->u.buffer)) { > + if (len > sizeof(u->u.buffer) - u->len) { > rc = -EINVAL; > goto out; > } > > >