bug-hurd
[Top][All Lists]
Advanced

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

pfinet: deadlock


From: Neal H Walfield
Subject: pfinet: deadlock
Date: Wed, 18 Jul 2001 16:14:57 +0200
User-agent: Mutt/1.3.18i

When parsing the options, pfinet will deadlock if it fails to set the
address, the network mask or the gateway, this fixes that:


2001-07-13  Neal H Walfield  <neal@cs.uml.edu>

        * options.c (parse_opt): In the cases where we hold global_lock
        and fail, we must release the lock before calling FAIL.

Index: options.c
===================================================================
RCS file: /home/neal/cvs/hurd/pfinet/options.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 options.c
--- options.c   2001/07/08 23:40:36     1.1.1.1
+++ options.c   2001/07/13 22:53:31
@@ -1,6 +1,6 @@
 /* Pfinet option parsing
 
-   Copyright (C) 1996,97,2000 Free Software Foundation, Inc.
+   Copyright (C) 1996,97,2000,01 Free Software Foundation, Inc.
 
    Written by Miles Bader <miles@gnu.org>
 
@@ -253,7 +253,10 @@ parse_opt (int opt, char *arg, struct ar
            err = configure_device (in->device, in->address, in->netmask,
                                    in->peer, INADDR_NONE);
            if (err)
-             FAIL (err, 16, 0, "cannot configure interface");
+             {
+               __mutex_unlock (&global_lock);
+               FAIL (err, 16, 0, "cannot configure interface");
+             }
          }
 
       /* Set the default gateway.  This code is cobbled together from what
@@ -289,7 +292,10 @@ parse_opt (int opt, char *arg, struct ar
              {
                err = - (*tb->tb_delete) (tb, &req.rtm, &rta, &req.nlh, 0);
                if (err && err != ESRCH)
-                 FAIL (err, 17, 0, "cannot remove old default gateway");
+                 {
+                   __mutex_unlock (&global_lock);
+                   FAIL (err, 17, 0, "cannot remove old default gateway");
+                 }
                err = 0;
              }
          }
@@ -302,12 +308,14 @@ parse_opt (int opt, char *arg, struct ar
            err = (!tb ? ENOBUFS
                   : - (*tb->tb_insert) (tb, &req.rtm, &rta, &req.nlh, 0));
            if (err)
-             FAIL (err, 17, 0, "cannot set default gateway");
+             {
+               __mutex_unlock (&global_lock);
+               FAIL (err, 17, 0, "cannot set default gateway");
+             }
          }
       }
 
       __mutex_unlock (&global_lock);
-
 
       /* Fall through to free hook.  */

Attachment: pgpgDm8iljddt.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]