WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [linux-2.6.18-xen] gnttab: Checking ->next is insufficie

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] gnttab: Checking ->next is insufficient to decide if something is
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Oct 2008 13:20:10 -0700
Delivery-date: Thu, 30 Oct 2008 13:20:02 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1225368066 0
# Node ID d49054ec0cc611391d3cbaae4ec77be1e8f7726b
# Parent  eb759c00a1f8147c103af82a01b97836f347f602
gnttab: Checking ->next is insufficient to decide if something is
queued in a singly-linked list (doesn't work for final item).

From: Jake Wires <jake.wires@xxxxxxxxxx>.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 drivers/xen/core/gnttab.c |    5 ++++-
 include/xen/gnttab.h      |    3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff -r eb759c00a1f8 -r d49054ec0cc6 drivers/xen/core/gnttab.c
--- a/drivers/xen/core/gnttab.c Thu Oct 30 11:59:46 2008 +0000
+++ b/drivers/xen/core/gnttab.c Thu Oct 30 12:01:06 2008 +0000
@@ -112,6 +112,7 @@ static void do_free_callbacks(void)
                next = callback->next;
                if (gnttab_free_count >= callback->count) {
                        callback->next = NULL;
+                       callback->queued = 0;
                        callback->fn(callback->arg);
                } else {
                        callback->next = gnttab_free_callback_list;
@@ -343,11 +344,12 @@ void gnttab_request_free_callback(struct
 {
        unsigned long flags;
        spin_lock_irqsave(&gnttab_list_lock, flags);
-       if (callback->next)
+       if (callback->queued)
                goto out;
        callback->fn = fn;
        callback->arg = arg;
        callback->count = count;
+       callback->queued = 1;
        callback->next = gnttab_free_callback_list;
        gnttab_free_callback_list = callback;
        check_free_callbacks();
@@ -365,6 +367,7 @@ void gnttab_cancel_free_callback(struct 
        for (pcb = &gnttab_free_callback_list; *pcb; pcb = &(*pcb)->next) {
                if (*pcb == callback) {
                        *pcb = callback->next;
+                       callback->queued = 0;
                        break;
                }
        }
diff -r eb759c00a1f8 -r d49054ec0cc6 include/xen/gnttab.h
--- a/include/xen/gnttab.h      Thu Oct 30 11:59:46 2008 +0000
+++ b/include/xen/gnttab.h      Thu Oct 30 12:01:06 2008 +0000
@@ -44,10 +44,11 @@
 #include <xen/features.h>
 
 struct gnttab_free_callback {
-       struct gnttab_free_callback *next;
+       struct list_head list;
        void (*fn)(void *);
        void *arg;
        u16 count;
+       u8 queued;
 };
 
 int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] gnttab: Checking ->next is insufficient to decide if something is, Xen patchbot-linux-2.6.18-xen <=