From ecce0788120f3e7db6248b3c5dbee6e06a5a1a95 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 26 Mar 2018 22:11:58 +0100 Subject: [PATCH] syscall: Fix open() panic introduced by lock change --- Kernel/syscall_fs3.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Kernel/syscall_fs3.c b/Kernel/syscall_fs3.c index b8404964..cdfa5c64 100644 --- a/Kernel/syscall_fs3.c +++ b/Kernel/syscall_fs3.c @@ -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: -- 2.34.1