Module Name:    src
Committed By:   bouyer
Date:           Sat Mar  5 15:12:16 UTC 2011

Modified Files:
        src/sys/arch/xen/xen: xbdback_xenbus.c

Log Message:
Test and set xbdi->xbdi_cont at splbio(). Otherwise we could overwrite
xbdi->xbdi_cont and process the same request twice.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/xen/xen/xbdback_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.32 src/sys/arch/xen/xen/xbdback_xenbus.c:1.33
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.32	Thu Jun 24 13:03:06 2010
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Sat Mar  5 15:12:16 2011
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbdback_xenbus.c,v 1.32 2010/06/24 13:03:06 hannken Exp $      */
+/*      $NetBSD: xbdback_xenbus.c,v 1.33 2011/03/05 15:12:16 bouyer Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.32 2010/06/24 13:03:06 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.33 2011/03/05 15:12:16 bouyer Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1370,6 +1370,7 @@
 	struct xbdback_io *xbd_io;
 	struct xbdback_instance *xbdi;
 	int errp;
+	int s;
 
 	xbd_io = bp->b_private;
 	xbdi = xbd_io->xio_xbdi;
@@ -1424,11 +1425,13 @@
 	atomic_dec_uint(&xbdi->xbdi_pendingreqs);
 	buf_destroy(&xbd_io->xio_buf);
 	xbdback_pool_put(&xbdback_io_pool, xbd_io);
+	s = splbio();
 	if (xbdi->xbdi_cont == NULL) {
 		/* check if there is more work to do */
 		xbdi->xbdi_cont = xbdback_co_main;
 		xbdback_trampoline(xbdi, xbdi);
 	}
+	splx(s);
 }
 
 /*

Reply via email to