syscall: Fix open() panic introduced by lock change
authorAlan Cox <alan@linux.intel.com>
Mon, 26 Mar 2018 21:11:58 +0000 (22:11 +0100)
committerAlan Cox <alan@linux.intel.com>
Mon, 26 Mar 2018 21:11:58 +0000 (22:11 +0100)
Kernel/syscall_fs3.c

index b840496..cdfa5c6 100644 (file)
@@ -80,18 +80,18 @@ arg_t _open(void)
        perm = getperm(ino);
        if ((r && !(perm & OTH_RD)) || (w && !(perm & OTH_WR))) {
                udata.u_error = EACCES;
-               goto idrop;//cantopen;
+               goto idrop;
        }
        if (w) {
                if (getmode(ino) == MODE_R(F_DIR)) {
                        udata.u_error = EISDIR;
-                       goto idrop;//cantopen;
+                       goto idrop;
                }
                /* Special case - devices on a read only file system may
                   be opened read/write */
                if (!isdevice(ino) && (ino->c_flags & CRDONLY)) {
                        udata.u_error = EROFS;
-                       goto idrop;//cantopen;
+                       goto idrop;
                }
        }
 
@@ -147,7 +147,8 @@ arg_t _open(void)
 
        return (uindex);
       idrop:
-       i_unlock_deref(ino);
+       i_unlock(ino);
+       /* Falls through and drops the reference count */
       cantopen:
        oft_deref(oftindex);    /* This will call i_deref() */
       nooft: