Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jan 2015 11:22:15 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 196718] kern_fcntl_freebsd() spills beyond old lock structure
Message-ID:  <bug-196718-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196718

            Bug ID: 196718
           Summary: kern_fcntl_freebsd() spills beyond old lock structure
           Product: Base System
           Version: 10.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: walter@pelissero.de

>From a look at kern_fcntl_freebsd() it seems to me that the old lock structure
is not properly filled in case of the F_OGETLK operation.
This should fix the bug:


--- kern_descrip.c    (revision 276910)
+++ kern_descrip.c    (working copy)
@@ -419,8 +419,10 @@
     struct __oflock ofl;
     intptr_t arg1;
     int error;
+    int newcmd;

     error = 0;
+    newcmd = cmd;
     switch (cmd) {
     case F_OGETLK:
     case F_OSETLK:
@@ -438,13 +440,13 @@

         switch (cmd) {
         case F_OGETLK:
-            cmd = F_GETLK;
+            newcmd = F_GETLK;
             break;
         case F_OSETLK:
-            cmd = F_SETLK;
+            newcmd = F_SETLK;
             break;
         case F_OSETLKW:
-            cmd = F_SETLKW;
+            newcmd = F_SETLKW;
             break;
         }
         arg1 = (intptr_t)&fl;
@@ -462,7 +464,7 @@
     }
     if (error)
         return (error);
-    error = kern_fcntl(td, fd, cmd, arg1);
+    error = kern_fcntl(td, fd, newcmd, arg1);
     if (error)
         return (error);
     if (cmd == F_OGETLK) {

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-196718-8>