---
 drivers/lguest/io.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/lguest/io.c b/drivers/lguest/io.c
index ea68613..39adf79 100644
--- a/drivers/lguest/io.c
+++ b/drivers/lguest/io.c
@@ -488,6 +488,7 @@ void send_dma(struct lguest *lg, unsigned long ukey, 
unsigned long udma)
        union futex_key key;
        int empty = 0;
        struct rw_semaphore *fshared = &current->mm->mmap_sem;
+       int found_guest = 0;
 
 again:
        mutex_lock(&lguest_lock);
@@ -510,6 +511,9 @@ again:
                        if (!key_eq(&key, &i->key))
                                continue;
 
+                       /* We found a guest to send to. */
+                       found_guest = 1;
+
                        /* If dma_transfer() tells us the destination has no
                         * available buffers, we increment "empty". */
                        empty += dma_transfer(lg, udma, i);
@@ -525,10 +529,12 @@ again:
                        empty++;
                        goto again;
                }
-       } else {
-               /* Private mapping: Guest is sending to its Launcher.  We set
-                * the "dma_is_pending" flag so that the main loop will exit
-                * and the Launcher's read() from /dev/lguest will return. */
+       }
+       if (found_guest == 0) {
+               /* Private mapping or a shared mapping which no guest has bound:
+                * Guest is sending to its Launcher.  We set the 
"dma_is_pending"
+                * flag so that the main loop will exit and the Launcher's 
read()
+                * from /dev/lguest will return. */
                lg->dma_is_pending = 1;
                lg->pending_dma = udma;
                lg->pending_key = ukey;
-- 
1.5.3.8


-- 
-----------------------------------------------------------
Paul "TBBle" Hampson, B.Sc, LPI, MCSE
Very-later-year Asian Studies student, ANU
The Boss, Bubblesworth Pty Ltd (ABN: 51 095 284 361)
[EMAIL PROTECTED]

Of course Pacman didn't influence us as kids. If it did,
we'd be running around in darkened rooms, popping pills and
listening to repetitive music.
 -- Kristian Wilson, Nintendo, Inc, 1989

License: http://creativecommons.org/licenses/by/2.1/au/
-----------------------------------------------------------

Attachment: pgp5JeS5ix7sE.pgp
Description: PGP signature

_______________________________________________
Lguest mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/lguest

Reply via email to