All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-2.6.18] xen: mark pvscsi frontend request consumed only after last read
@ 2015-01-30 13:51 Juergen Gross
  2015-01-30 14:22 ` Jan Beulich
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Juergen Gross @ 2015-01-30 13:51 UTC (permalink / raw)
  To: xen-devel, jbeulich; +Cc: Juergen Gross

A request in the ring buffer mustn't be read after it has been marked
as consumed. Otherwise it might already have been reused by the
frontend without violating the ring protocol.

To avoid inconsistencies in the backend only work on a private copy
of the request. This will ensure a malicious guest not being able to
bypass consistency checks of the backend by modifying an active
request.

Signed-off-by: Juergen Gross <jgross@suse.com>

diff -r 578e5aea3cbb drivers/xen/scsiback/scsiback.c
--- a/drivers/xen/scsiback/scsiback.c	Mon Jan 19 11:51:46 2015 +0100
+++ b/drivers/xen/scsiback/scsiback.c	Fri Jan 30 14:43:29 2015 +0100
@@ -579,7 +579,7 @@ invalid_value:
 static int _scsiback_do_cmd_fn(struct vscsibk_info *info)
 {
 	struct vscsiif_back_ring *ring = &info->ring;
-	vscsiif_request_t  *ring_req;
+	vscsiif_request_t ring_req;
 
 	pending_req_t *pending_req;
 	RING_IDX rc, rp;
@@ -609,10 +609,10 @@ static int _scsiback_do_cmd_fn(struct vs
 			break;
 		}
 
-		ring_req = RING_GET_REQUEST(ring, rc);
+		ring_req = *RING_GET_REQUEST(ring, rc);
 		ring->req_cons = ++rc;
 
-		err = prepare_pending_reqs(info, ring_req,
+		err = prepare_pending_reqs(info, &ring_req,
 						pending_req);
 		switch (err ?: pending_req->act) {
 		case VSCSIIF_ACT_SCSI_CDB:

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

end of thread, other threads:[~2015-02-02 10:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-30 13:51 [PATCH linux-2.6.18] xen: mark pvscsi frontend request consumed only after last read Juergen Gross
2015-01-30 14:22 ` Jan Beulich
2015-01-30 14:32   ` Jan Beulich
     [not found]   ` <54CBA41E020000780005B5D7@suse.com>
2015-01-30 14:40     ` Juergen Gross
     [not found] ` <54CBA1CA020000780005B5A0@suse.com>
2015-01-30 14:26   ` Juergen Gross
2015-02-02  7:52 ` Jan Beulich
2015-02-02 10:17   ` Juergen Gross

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.