[Bug 196718] kern_fcntl_freebsd() spills beyond old lock structure

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Jan 14 11:22:15 UTC 2015


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 at FreeBSD.org
          Reporter: walter at 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.


More information about the freebsd-bugs mailing list