Re: [Qemu-devel] [PATCH 3/3] virtio-blk: Treat read/write beyond end as invalid

2014-06-27 Thread Stefan Hajnoczi
On Mon, Jun 23, 2014 at 02:57:36PM +0200, Markus Armbruster wrote: > Markus Armbruster writes: > > > Stefan Hajnoczi writes: > > > >> On Thu, Jun 05, 2014 at 02:15:36PM +0200, Markus Armbruster wrote: > >>> +if (sector > total_sectors || nb_sectors > total_sectors - sector) { > >>> +

Re: [Qemu-devel] [PATCH 3/3] virtio-blk: Treat read/write beyond end as invalid

2014-06-23 Thread Markus Armbruster
Markus Armbruster writes: > Stefan Hajnoczi writes: > >> On Thu, Jun 05, 2014 at 02:15:36PM +0200, Markus Armbruster wrote: >>> +if (sector > total_sectors || nb_sectors > total_sectors - sector) { >>> +return false; >>> +} >> >> if (sector >= total_sectors || ...) { > > I suspec

Re: [Qemu-devel] [PATCH 3/3] virtio-blk: Treat read/write beyond end as invalid

2014-06-23 Thread Markus Armbruster
Stefan Hajnoczi writes: > On Thu, Jun 05, 2014 at 02:15:36PM +0200, Markus Armbruster wrote: >> +if (sector > total_sectors || nb_sectors > total_sectors - sector) { >> +return false; >> +} > > if (sector >= total_sectors || ...) { I suspect reading bdrv_check_byte_request() put

Re: [Qemu-devel] [PATCH 3/3] virtio-blk: Treat read/write beyond end as invalid

2014-06-19 Thread Stefan Hajnoczi
On Thu, Jun 05, 2014 at 02:15:36PM +0200, Markus Armbruster wrote: > +if (sector > total_sectors || nb_sectors > total_sectors - sector) { > +return false; > +} if (sector >= total_sectors || ...) { pgpUGK7ac14gb.pgp Description: PGP signature

Re: [Qemu-devel] [PATCH 3/3] virtio-blk: Treat read/write beyond end as invalid

2014-06-05 Thread Fam Zheng
On Thu, 06/05 14:15, Markus Armbruster wrote: > The block layer fails such reads and writes just fine. However, they > then get treated like valid operations that fail: the error action > gets executed. Unwanted; reporting the error to the guest is the only > sensible action. > > Reject them bef

[Qemu-devel] [PATCH 3/3] virtio-blk: Treat read/write beyond end as invalid

2014-06-05 Thread Markus Armbruster
The block layer fails such reads and writes just fine. However, they then get treated like valid operations that fail: the error action gets executed. Unwanted; reporting the error to the guest is the only sensible action. Reject them before passing them to the block layer. This bypasses the er