All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>,
	xen-devel <xen-devel@lists.xen.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [Xen-devel] [PATCH 3/3] xen/blkback: Check for insane amounts of request on the ring.
Date: Mon, 28 Jan 2013 10:42:32 -0500	[thread overview]
Message-ID: <20130128154231.GF4838@konrad-lan.dumpdata.com> (raw)
In-Reply-To: <51066A1202000078000BA020@nat28.tlf.novell.com>

On Mon, Jan 28, 2013 at 11:07:46AM +0000, Jan Beulich wrote:
> >>> On 25.01.13 at 19:43, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> > @@ -764,6 +768,9 @@ __do_block_io_op(struct xen_blkif *blkif)
> >  	rp = blk_rings->common.sring->req_prod;
> >  	rmb(); /* Ensure we see queued requests up to 'rp'. */
> >  
> > +	if (RING_REQUEST_PROD_OVERFLOW(&blk_rings->common, rp, rc))
> > +		return -EACCES;
> 
> Actually I wonder whether we need the new macro at all: It seems
> to me that using RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, rp)
> here would achieve the same effect.

But it would not. The RING_REQUEST_CONS_OVERFLOW only check that the
non-shared ring entries (rsp_prod and rsp_prod_pvt) are less than
the size of the ring (32). In other words - they check whether we want
to process more requests as we still have a back-log of responses to
deal with.

This new macro would check for the req_prod being bogus and out of
bounds. Bounds being the difference between rsp_prod and req_prod
being bigger than ring (32).

> 
> Jan
> 
> > +
> >  	while (rc != rp) {
> >  
> >  		if (RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, rc))
> 
> 

  reply	other threads:[~2013-01-28 15:42 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-25 17:32 [PATCH] block backend fixes for v3.8 (and stable) v1 Konrad Rzeszutek Wilk
2013-01-25 17:32 ` [PATCH 1/3] xen/blkback: Don't trust the handle from the frontend Konrad Rzeszutek Wilk
2013-01-28 11:09   ` Jan Beulich
2013-01-28 11:09   ` [Xen-devel] " Jan Beulich
2013-01-25 17:32 ` [PATCH 2/3] xen/ring: Add a new macro to detect whether there is an overflow in requests and response Konrad Rzeszutek Wilk
2013-01-25 17:45   ` [Xen-devel] " Roger Pau Monné
2013-01-25 17:45     ` Roger Pau Monné
2013-01-25 18:29     ` [Xen-devel] " Konrad Rzeszutek Wilk
2013-01-25 18:29       ` Konrad Rzeszutek Wilk
2013-01-25 18:41     ` Konrad Rzeszutek Wilk
2013-01-25 18:41       ` Konrad Rzeszutek Wilk
2013-01-25 18:41       ` Konrad Rzeszutek Wilk
2013-01-25 18:41   ` Konrad Rzeszutek Wilk
2013-01-25 17:32 ` [PATCH 3/3] xen/blkback: Check for insane amounts of request on the ring Konrad Rzeszutek Wilk
2013-01-25 18:43   ` Konrad Rzeszutek Wilk
2013-01-28 11:07     ` Jan Beulich
2013-01-28 11:07     ` [Xen-devel] " Jan Beulich
2013-01-28 15:42       ` Konrad Rzeszutek Wilk [this message]
2013-01-28 16:18         ` Jan Beulich
2013-01-28 16:18         ` [Xen-devel] " Jan Beulich
2013-01-28 16:47           ` Konrad Rzeszutek Wilk
2013-01-28 16:47           ` Konrad Rzeszutek Wilk
2013-01-28 15:42       ` Konrad Rzeszutek Wilk
2013-01-28 11:38     ` [Xen-devel] " David Vrabel
2013-01-28 11:38       ` David Vrabel
2013-01-28 15:44       ` Konrad Rzeszutek Wilk
2013-01-28 16:03         ` David Vrabel
2013-01-28 16:03           ` David Vrabel
2013-01-28 16:13           ` Konrad Rzeszutek Wilk

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=20130128154231.GF4838@konrad-lan.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=konrad@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.