Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/dist/ipf/netinet Apply patches (requested by chs in t...



details:   https://anonhg.NetBSD.org/src/rev/a6d1fa5a86eb
branches:  netbsd-6
changeset: 775733:a6d1fa5a86eb
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Mar 14 22:33:15 2013 +0000

description:
Apply patches (requested by chs in ticket #844):
src/sys/dist/ipf/netinet/fil.c                  patch
src/sys/dist/ipf/netinet/ip_lookup.c            patch

        Fix some problems in IPF where a lock may be left locked
        when it should be released or unlocked when it's not locked.
        [chs, ticket #844]

diffstat:

 sys/dist/ipf/netinet/fil.c       |  12 +++++-------
 sys/dist/ipf/netinet/ip_lookup.c |   5 ++---
 2 files changed, 7 insertions(+), 10 deletions(-)

diffs (74 lines):

diff -r cf9e1b80468b -r a6d1fa5a86eb sys/dist/ipf/netinet/fil.c
--- a/sys/dist/ipf/netinet/fil.c        Thu Mar 14 22:04:32 2013 +0000
+++ b/sys/dist/ipf/netinet/fil.c        Thu Mar 14 22:33:15 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fil.c,v 1.53 2012/02/15 17:55:21 riz Exp $     */
+/*     $NetBSD: fil.c,v 1.53.2.1 2013/03/14 22:33:15 riz Exp $ */
 
 /*
  * Copyright (C) 1993-2010 by Darren Reed.
@@ -157,7 +157,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.53 2012/02/15 17:55:21 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.53.2.1 2013/03/14 22:33:15 riz Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c        1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 2.243.2.154 2010/02/24 10:07:57 darrenr Exp";
@@ -6617,9 +6617,6 @@
 /* matches the tuple (type, uid, ptr).  If one cannot be found then one is  */
 /* allocated.  If one is found then it is moved to the top of the list of   */
 /* currently active tokens.                                                 */
-/*                                                                          */
-/* NOTE: It is by design that this function returns holding a read lock on  */
-/*       ipf_tokens.  Callers must make sure they release it!               */
 /* ------------------------------------------------------------------------ */
 ipftoken_t *
 ipf_findtoken(int type, int uid, void *ptr)
@@ -6638,8 +6635,10 @@
        if (it == NULL) {
                it = new;
                new = NULL;
-               if (it == NULL)
+               if (it == NULL) {
+                       RWLOCK_EXIT(&ipf_tokens);
                        return NULL;
+               }
                it->ipt_data = NULL;
                it->ipt_ctx = ptr;
                it->ipt_uid = uid;
@@ -7014,7 +7013,6 @@
                RWLOCK_EXIT(&ipf_tokens);
        } else
                error = EFAULT;
-       RWLOCK_EXIT(&ipf_tokens);
 
        return error;
 }
diff -r cf9e1b80468b -r a6d1fa5a86eb sys/dist/ipf/netinet/ip_lookup.c
--- a/sys/dist/ipf/netinet/ip_lookup.c  Thu Mar 14 22:04:32 2013 +0000
+++ b/sys/dist/ipf/netinet/ip_lookup.c  Thu Mar 14 22:33:15 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_lookup.c,v 1.19 2012/02/15 17:55:22 riz Exp $       */
+/*     $NetBSD: ip_lookup.c,v 1.19.2.1 2013/03/14 22:33:16 riz Exp $   */
 
 /*
  * Copyright (C) 2002-2003 by Darren Reed.
@@ -67,7 +67,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_lookup.c,v 1.19 2012/02/15 17:55:22 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_lookup.c,v 1.19.2.1 2013/03/14 22:33:16 riz Exp $");
 #else
 static const char rcsid[] = "@(#)Id: ip_lookup.c,v 2.35.2.22 2010/01/31 16:22:55 darrenr Exp";
 #endif
@@ -612,7 +612,6 @@
        SPL_SCHED(s);
        token = ipf_findtoken(iter.ili_key, uid, ctx);
        if (token == NULL) {
-               RWLOCK_EXIT(&ipf_tokens);
                SPL_X(s);
                return ESRCH;
        }



Home | Main Index | Thread Index | Old Index