From de6977375692d00b12fdbf3960101e240279f967 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 8 Nov 2017 15:52:47 +0000 Subject: [PATCH] syscall_fs: stop pipe() working with a r/o fs backing it --- Kernel/syscall_fs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Kernel/syscall_fs.c b/Kernel/syscall_fs.c index b4e07214..c4b1605a 100644 --- a/Kernel/syscall_fs.c +++ b/Kernel/syscall_fs.c @@ -324,6 +324,11 @@ arg_t _pipe(void) goto nogood2; } + if (ino->c_flags & CRDONLY) { + udata.u_error = EROFS; + goto nogood3; + } + udata.u_files[u2] = oft2; of_tab[oft1].o_ptr = 0; @@ -345,6 +350,8 @@ arg_t _pipe(void) uputw(u2, fildes + 1); return (0); + nogood3: + i_deref(ino); nogood2: oft_deref(oft1); udata.u_files[u1] = NO_FILE; -- 2.34.1