Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern fix off-by-one in wapbl_write_revocations() - when ...



details:   https://anonhg.NetBSD.org/src/rev/fadfe2419338
branches:  trunk
changeset: 818189:fadfe2419338
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Oct 02 16:44:02 2016 +0000

description:
fix off-by-one in wapbl_write_revocations() - when exiting the write loop,
wd gets set to next unwritten record, not last written one as code assumed;
'lost head!' KASSERT is not triggered any more

diffstat:

 sys/kern/vfs_wapbl.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 261d2bb6a657 -r fadfe2419338 sys/kern/vfs_wapbl.c
--- a/sys/kern/vfs_wapbl.c      Sun Oct 02 15:27:32 2016 +0000
+++ b/sys/kern/vfs_wapbl.c      Sun Oct 02 16:44:02 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_wapbl.c,v 1.82 2016/10/02 14:38:46 jdolecek Exp $  */
+/*     $NetBSD: vfs_wapbl.c,v 1.83 2016/10/02 16:44:02 jdolecek Exp $  */
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.82 2016/10/02 14:38:46 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.83 2016/10/02 16:44:02 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
@@ -2358,11 +2358,11 @@
                /* free all successfully written deallocs */
                lwd = wd;
                while ((wd = SIMPLEQ_FIRST(&wl->wl_dealloclist)) != NULL) {
+                       if (wd == lwd)
+                               break;
                        SIMPLEQ_REMOVE_HEAD(&wl->wl_dealloclist, wd_entries);
                        pool_put(&wapbl_dealloc_pool, wd);
                        wl->wl_dealloccnt--;
-                       if (wd == lwd)
-                               break;
                }
        }
        *offp = off;



Home | Main Index | Thread Index | Old Index