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-devel

[Xen-devel] [PATCH]: libblktapctl, fix use-after-free bug

To: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH]: libblktapctl, fix use-after-free bug
From: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Date: Tue, 3 Aug 2010 16:55:17 +0100
Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Tue, 03 Aug 2010 09:00:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
This has not caused crashes because generally use after free is OK
provided nothing else is going on. However the patch makes things
correct. It also allows us to use heap poisoning feature of valgrind on
tools linking to libblktapctl.

diff -r 5c5a6081f258 tools/blktap2/control/tap-ctl-list.c
--- a/tools/blktap2/control/tap-ctl-list.c      Tue Aug 03 15:42:53 2010 +0100
+++ b/tools/blktap2/control/tap-ctl-list.c      Tue Aug 03 16:55:04 2010 +0100
@@ -385,9 +385,9 @@ _tap_ctl_free_tapdisks(struct tapdisk *t
        struct tapdisk *tap;
 
        for (tap = tapv; tap < &tapv[n_taps]; ++tap) {
-               struct tapdisk_list *tl;
+               struct tapdisk_list *tl, *next;
 
-               list_for_each_entry(tl, &tap->list, entry) {
+               list_for_each_entry_safe(tl, next, &tap->list, entry) {
                        free(tl->params);
                        free(tl);
                }



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH]: libblktapctl, fix use-after-free bug, Gianni Tedesco <=