All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] block: Fix unaligned bdrv_aio_write_zeroes
@ 2015-04-24  8:33 Fam Zheng
  2015-04-24  8:33 ` [Qemu-devel] [PATCH 1/3] scsi-disk: Limit zero write request to SCSI_WRITE_SAME_MAX Fam Zheng
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Fam Zheng @ 2015-04-24  8:33 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Paolo Bonzini, qemu-block, Stefan Hajnoczi,
	qemu-stable

An unaligned zero write causes NULL deferencing in bdrv_co_do_pwritev. That
path is reachable from bdrv_co_write_zeroes and bdrv_aio_write_zeroes.

You can easily trigger through the former with qemu-io, as the test case added
by 61815d6e0aa. For bdrv_aio_write_zeroes, in common cases there's always a
format driver (which uses 512 alignment), so it would be much rarer to have
unaligned requests (only concerning top level here, when the request goes down
to bs->file, where for example the alignment is 4k, it would then be calling
bdrv_co_write_zeroes because it's in a coroutine).

fc3959e4669a1c fixed bdrv_co_write_zeroes but not bdrv_aio_write_zeroes.  The
lattern is the actually used one by device model. Revert the previous fix, do
it in bdrv_co_do_pwritev, to cover both paths.

Fam


Fam Zheng (3):
  scsi-disk: Limit zero write request to SCSI_WRITE_SAME_MAX
  block: Fix NULL deference for unaligned write if qiov is NULL
  Revert "block: Fix unaligned zero write"

 block.c             | 69 ++++++++++++++++++++---------------------------------
 hw/scsi/scsi-disk.c |  7 +++++-
 2 files changed, 32 insertions(+), 44 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-24  9:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24  8:33 [Qemu-devel] [PATCH 0/3] block: Fix unaligned bdrv_aio_write_zeroes Fam Zheng
2015-04-24  8:33 ` [Qemu-devel] [PATCH 1/3] scsi-disk: Limit zero write request to SCSI_WRITE_SAME_MAX Fam Zheng
2015-04-24  8:50   ` Paolo Bonzini
2015-04-24  9:02     ` Fam Zheng
2015-04-24  9:03       ` Paolo Bonzini
2015-04-24  8:33 ` [Qemu-devel] [PATCH 2/3] block: Fix NULL deference for unaligned write if qiov is NULL Fam Zheng
2015-04-24  9:01   ` Paolo Bonzini
2015-04-24  8:33 ` [Qemu-devel] [PATCH 3/3] Revert "block: Fix unaligned zero write" Fam Zheng

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.