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] [qemu-xen-unstable] keymaps.c: fix use after free in del

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [qemu-xen-unstable] keymaps.c: fix use after free in del_key_range
From: patchbot@xxxxxxx
Date: Mon, 17 Jan 2011 10:05:04 -0800
Delivery-date: Mon, 17 Jan 2011 10:05:10 -0800
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
commit fdb22f24bc8adb3455b771d804496e11b4570085
Author: Jan Beulich <jbeulich@xxxxxxxxxx>
Date:   Mon Jan 17 18:00:37 2011 +0000

    keymaps.c: fix use after free in del_key_range
    
    Commit 99d53fbb69d3e03be61ae10506a304a3d08d792f introduced this, and
    the compiler indirectly warned about it.
    
    The patch is only compile tested (I don't even know how to reproduce
    the original problem), but I suppose worth applying regardless.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
    Cc: Chun Yan Liu <cyliu@xxxxxxxxxx>
---
 keymaps.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/keymaps.c b/keymaps.c
index 12b83a5..d92057f 100644
--- a/keymaps.c
+++ b/keymaps.c
@@ -56,15 +56,12 @@ typedef struct {
 
 static void del_key_range(struct key_range **krp, int code) {
     struct key_range *kr;
-    struct key_range *kr_pr;
-    for (kr = *krp; kr; kr_pr = kr, kr = kr->next) {
+    while ((kr = *krp) != NULL) {
         if (code >= kr->start && code <= kr->end) {
-            if (kr == *krp)
-                *krp = kr->next;
-            else
-                kr_pr->next = kr->next;
+            *krp = kr->next;
             qemu_free(kr);
-        }
+        } else
+            krp = &kr->next;
     }
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [qemu-xen-unstable] keymaps.c: fix use after free in del_key_range, patchbot <=