* [Qemu-devel] [PATCH] xen_disk: move sanity check to the correct place
@ 2009-05-28 11:24 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2009-05-28 11:24 UTC (permalink / raw)
To: qemu-devel@nongnu.org; +Cc: Xen Development Mailing List
[-- Attachment #1: Type: text/plain, Size: 152 bytes --]
Hi,
The sanity check which refuses write access to disks configured
read-only is at the wrong place. This patch fixes it.
please apply,
Gerd
[-- Attachment #2: 0001-xen_disk-move-sanity-check-to-the-correct-place.patch --]
[-- Type: text/plain, Size: 1278 bytes --]
>From d4a9e1a335efd0e2e753e1752570b0dd527a12bc Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Wed, 22 Apr 2009 12:53:01 +0200
Subject: [PATCH 01/21] xen_disk: move sanity check to the correct place
---
hw/xen_disk.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index f95e373..659a839 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -179,10 +179,6 @@ static int ioreq_parse(struct ioreq *ioreq)
switch (ioreq->req.operation) {
case BLKIF_OP_READ:
ioreq->prot = PROT_WRITE; /* to memory */
- if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') {
- xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n");
- goto err;
- }
break;
case BLKIF_OP_WRITE_BARRIER:
if (!syncwrite)
@@ -199,6 +195,11 @@ static int ioreq_parse(struct ioreq *ioreq)
goto err;
};
+ if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') {
+ xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n");
+ goto err;
+ }
+
ioreq->start = ioreq->req.sector_number * blkdev->file_blk;
for (i = 0; i < ioreq->req.nr_segments; i++) {
if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) {
--
1.6.2.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] xen_disk: move sanity check to the correct place
@ 2009-05-28 11:24 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2009-05-28 11:24 UTC (permalink / raw)
To: qemu-devel@nongnu.org; +Cc: Xen Development Mailing List
[-- Attachment #1: Type: text/plain, Size: 152 bytes --]
Hi,
The sanity check which refuses write access to disks configured
read-only is at the wrong place. This patch fixes it.
please apply,
Gerd
[-- Attachment #2: 0001-xen_disk-move-sanity-check-to-the-correct-place.patch --]
[-- Type: text/plain, Size: 1278 bytes --]
>From d4a9e1a335efd0e2e753e1752570b0dd527a12bc Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Wed, 22 Apr 2009 12:53:01 +0200
Subject: [PATCH 01/21] xen_disk: move sanity check to the correct place
---
hw/xen_disk.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index f95e373..659a839 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -179,10 +179,6 @@ static int ioreq_parse(struct ioreq *ioreq)
switch (ioreq->req.operation) {
case BLKIF_OP_READ:
ioreq->prot = PROT_WRITE; /* to memory */
- if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') {
- xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n");
- goto err;
- }
break;
case BLKIF_OP_WRITE_BARRIER:
if (!syncwrite)
@@ -199,6 +195,11 @@ static int ioreq_parse(struct ioreq *ioreq)
goto err;
};
+ if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') {
+ xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n");
+ goto err;
+ }
+
ioreq->start = ioreq->req.sector_number * blkdev->file_blk;
for (i = 0; i < ioreq->req.nr_segments; i++) {
if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) {
--
1.6.2.2
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-05-28 11:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28 11:24 [Qemu-devel] [PATCH] xen_disk: move sanity check to the correct place Gerd Hoffmann
2009-05-28 11:24 ` Gerd Hoffmann
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.